How to identify when user disconnect from Bot

Hi Team,

I want to implement following scenario.

I am chatting with Bot. All of sudden because of some issue I disconnected from Bot (reason may be I closed the Bot Interface, Internet Connection drops etc). In this case I want to generate SalesForce Case with Status as Cancelled. What are the different ways I can achieve it?
Can I read the session between conversation?
How do I identify that Session is no more alive?
Can I write some handlers or Webhook around it?

Please reply something on this topic. I am eagerly waiting for it.

Hi @praful_dhone,

Please find the below snippet in the chatWindow.js that will get triggered when the close button on the chat window is clicked.‘click’, ‘.close-btn’).on(‘click’, ‘.close-btn’, function (event) {
if (ttsAudioSource) {
me.isTTSOn = false;
if (_ttsContext) {
_ttsContext = null;
if (me.config.multiPageApp && me.config.multiPageApp.enable) {
me.config.botOptions.maintainContext = false;
You can write the script as per your requirement in this function so that it will get executed when the chat window is closed.

Also, you can use botKit SDK functions which will be helpful to achieve your requirement.

Let us know if you need any further infromation.

Yoga Ramya