I have live chat integrated with my bot. However when the live agent closes the chat. I am trying to send the message to user that “live agent has closed the chat and the user can start chatting with the bot” .
Hi @arulvelug, When the agent conversation is closed, LiveChat Inc is sending two events to bot kit, both of which have the event type as ‘chat_closed’.
// displaying the event payload as received at the bot from LiveChat.js file
else if (event.type===“chat_closed”){
console.log(“chat_Closed”,event);
These events will differ on the user_ type visitor/ agent. You could possibly apply the condition to display the message to the end user based on either of these. Please refer to below configuration.
else if (event.type==="chat_closed" && event.user_type==='agent'){
console.log("chat_Closed",event);
delete userResponseDataMap[visitorId];
delete _map[visitorId];
data.message="You conversation with the agent ended. You can continue chatting with the bot";
sdk.sendUserMessage(data);
sdk.clearAgentSession(data);
}