The following are events to which you can subscribe your chat widget.
Update:
Events with lowercase names are deprecated. Please migrate to the new event names to ensure compatibility.
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. |
If you're currently using the deprecated lowercase event names, update the code to use the new camelCase event names as shown below:
Old case | New case |
---|---|
chatend | chatEnd |
submitinitialform | submitInitialForm |
agentleft | agentLeft |
agentjoined | agentJoined |
SinchSdk.Chat.addEventListener('token', () => {
SinchSdk.Chat.send('message');
});
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.

For example, you might want to display a message or redirect the user when the chat ends:
SinchSdk.Chat.addEventListener('chatEnd', () => {
// Show a message or perform cleanup
alert('The chat session has ended.');
});