Most deprecated functions are still supported but not recommended. Bot developers are encouraged to use stated alternatives instead.
Get channel
This function is supported but not recommended. Bot developers are encouraged to use getUserChannel instead.
getChannel
returns the platform channel the user is currently communicating on. This function returns — lp_sms, lp_web, lp_inapp, sms, web, inapp. lp_ prefix indicates the LivePerson platform.
Function Name | Arguments | Returns |
---|---|---|
getChannel() |
None | lp_sms, lp_web, lp_inapp, sms, web, inapp |
Example
var channel = botContext.getChannel();
botContext.printDebugMessage("channel used by the user is: " + channel);
Add quick reples
This function is supported but not recommended. Bot developers are encouraged to use addQuickReplies instead.
The Add Quick Reples function is used for adding quick replies to a message in JavaScript rather than defining in bot creation. This allows for the dynamic addition of the buttons to accommodate various scenarios.
Function Name | Arguments | Returns |
---|---|---|
addQuickReples() |
array | None |
Example
The example below shows how quick replies can be added easily to your message.
// Add these quick replies to an existing message
botContext.addQuickReples(['Ranch~sauce01','Honey Mustard~sauce02','BBQ~sauce03','Hot~sauce04']);
Log escalation event
This function isn't supported. The system logs escalation events automatically, and this data is viewable in Bot Analytics.
logEscalationEvent
is used to count the number of times the user called a particular escalation type. The function requries a user input and the string 'LivePerson' for the type of escalation.
Function Name | Arguments | Returns |
---|---|---|
logEscalationEvent(user_message, escalation_type) |
user_message — the user's message text escalation_type — 'LivePerson' |
void |
Example
botContext.logEscalationEvent(botContext.getCurrentUserMessage(), 'LivePerson');