End WebChat when browser disconnected

How to handle/properly end the webchat when a browser is closed by the customer

Hi @Maragatham,
Not sure how you would detect that the customer has closed the browser, but you can programmatically disconnect the chat and set the wrapup code using the API resource PATCH /api/v2/conversations/chats/{conversationId}/participants/{participantId}. From a client-side javascript standpoint in the site hosting the web chat widget, you could use event handling and timeouts to implement the decision making for when the chat should be disconnected, e.g. - after 10 minutes of no messages received, disconnect the chat.

Do we have any sample of events that can be used to capture the browser disconnect from client-side in Javascript of web chat widget.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.