Conversation Toolkit API
Console integration APIs for Live Agent.
Descriptor
lightning:conversationToolkitAPITargets
Lightning Experience
The lightning:conversationToolkitAPI component provides methods to interact with a chat visitor.
Methods
This component supports the following methods. For more information, see the Console Developer Guide.
endChat({recordId})
: Ends the chat.
recordId
(string): ID of the chat that you want to end.
Returns a Promise. Success resolves to true. The Promise is rejected if there's an error.
sendMessage({recordId, message})
: Sends a message to the chat visitor.
recordId
(string): ID of the chat that is in progress.message
(object): Message that is sent to the visitor. This object contains atext
string, which has the actual message.
Returns a Promise. Success resolves to true. The Promise is rejected if there's an error.
For an example, see sendMessage() in the Console Developer Guide.
sendCustomEvent({recordId, type, data})
: Sends a custom event to the visitor.
recordId
(string): ID of the chat that's in progress.type
(string): Event type.data
(string): Event data.
Returns a Promise. Success resolves to true. The Promise is rejected if there's an error.
getChatLog({recordId})
: Gets the chat log.
recordId
(string): ID of the chat that you want to get the log.
Returns a Promise. Success resolves to a response object contains messages
and customEvents
properties. The Promise will be rejected on error.