sendMessage() for Lightning Experience

Sends a new chat message from the agent to a chat with a specific chat key. This method works only in Lightning console apps.

NameTypeDescription
argumentObjObjectAn object containing all the arguments to be passed into this method.
NameTypeDescription
recordIdStringThe ID of the chat that you want to end.
messageObjectAn object containing the data to send in the message.
NameTypeDescription
textStringThe text to be sent in the message.

This example sends a message to the visitor and logs the result.

Component Code:

Controller Code:

Returns a Promise. Success resolves to true. The Promise is rejected if there’s an error.