Call function on error

Listen to events from the bot, and use them on your website.

Listener Function

You will have to update the bot script in order to define the function which will be called when loading webchat fail.

Add an onError parameter in the clustaarSettings.

window.clustaarSettings = {
            bot_id: YOUR_BOT_ID,
            bot_token: YOUR_BOT_TOKEN,
            onError: myOnErrorFunction
};

Then, define the myOnErrorFunction function on your website so it can be triggered if webchat is not activated or fail to load. .

function myOnErrorFunction() {
  console.log("Webchat couldn't load because not activated or else");
}