Chat Widget events

The following are events to which you can subscribe your chat widget.

Event type Description
token Issued when a user token is assigned.
open Issued the chat widget is opened.
close Issued the chat widget is closed.
chatend Issued when a chat session has ended.
submitinitialform Issued when the initial form is submitted.
agentleft Issued when the agent has left the conversation.
agentjoined Issued when the agent has joined the conversation.

Example of usage:

Copy
Copied
SinchSdk.Chat.addEventListener('token', () => {
  SinchSdk.Chat.send('message');
});

How the chatend event works

The chatend event is triggered when a chat session has ended, either by the user or the agent. You can use this event to perform cleanup actions, show a feedback form, or notify the user that the conversation is over.

End chat session

For example, you might want to display a message or redirect the user when the chat ends:

Copy
Copied
SinchSdk.Chat.addEventListener('chatend', () => {
  // Show a message or perform cleanup
  alert('The chat session has ended.');
});
We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.