lightning:conversationAgentSend

Event triggered when an agent sends a chat message through the Salesforce console. This method does not intercept the message before it’s sent to the chat visitor. This event is also triggered when using Enhanced Messaging channels.

Response 

NameTypeDescription
recordIdStringThe ID of the work record that’s associated with the current chat.
contentStringThe text of the message in the chat log.
nameStringThe name of the agent who is attempting to send the message. This name matches the agent name displayed in the chat log.
typeStringThe type of message that was received—for example, agent.
timestampDate/TimeThe date and time that the agent attempted to send the chat message.

Example 

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" description="Conversation toolkit api sample">
2  <lightning:conversationToolkitAPI aura:id="conversationKit" />
3  <aura:handler event="lightning:conversationAgentSend" action="{! c.onAgentSend}" />
4</aura:component>

Controller code:

1({
2    onAgentSend: function(cmp, evt, helper) {
3        var recordId = evt.getParam("recordId");
4        var content = evt.getParam("content");
5        var name = evt.getParam("name");
6        var type = evt.getParam("type");
7        var timestamp = evt.getParam("timestamp");
8
9        console.log("recordId:" + recordId + " content:" + content + " name:" + name + " timestamp:" + timestamp);
10    }
11})