getChatLog() for Lightning Experience

Returns the chat log of an Enhanced Messaging chat associated with a specific recordId. 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 work associated with the current chat.

This example retrieves the chat log for the given chat, logs the result, and if successful, saves the result to a variable.

Component Code:

Controller Code:

Returns a Promise. Success resolves to a response object containing the messages. The Promise is rejected if there’s an error.

NameTypeDescription
messagesArray of message objects.An array of chat message objects containing all of the chat messages from the chat log.

The message object contains a single chat message from the chat log and the following properties:

PropertyTypeDescription
contentStringThe text content of a message in the chat log.
nameStringThe name of the user who sent the message in the chat log. This name appears exactly as it is displayed in the chat log.
typeStringThe type of message that was received, such as Agent or Visitor.
timestampDate/TimeThe date and time the chat message was received.