Salesforce Chats can be ended by
- Agents
- BOTs
- Visitors
embedded_svc.addEventHandler() can be used for listening onChatEndedByChasitor, onChatEndedByAgent and onChatEndedByChatbot events.
Sample Code:
embedded_svc.addEventHandler(
"onChatEndedByChasitor",
function( data ) {
console.log(
'Chat was ended by the Visitor'
);
} );
embedded_svc.addEventHandler(
"onChatEndedByAgent",
function( data ) {
console.log(
'Chat was ended by the Agent'
);
} );
embedded_svc.addEventHandler(
"onChatEndedByChatbot",
function( data ) {
console.log(
'Chat was ended by the BOT'
);
} );
embedded_svc.addEventHandler() should be added before the embedded_svc.init().