Handling errors

Chatbots are software. And software can break sometimes – you can have a wrong API call in a JSON block, Google integration can fail, or something else can happen unexpectedly. Handling errors properly is extremely important so that they do not break your end-user chatbot experiences.

You may have already noticed an “ERROR” button in some of the chatbot building blocks in Activechat. This button is for error handling.

The picture above shows an example of error handling. If something goes wrong when the JSON block is executed, the “ERROR” button will get control and a TEXT block will be triggered. It will display the error message to your bot user, offering an option to click the button to retry the action. Please note that this “Retry” button is connected back to the JSON block so that it will be triggered again when a user clicks the button (kind of a potential dead loop here, so we're leaving the exercise of providing a way out of it for your own experiment).

You can definitely build a more complex error handling, maybe even create specific skills for each of your critical conversation blocks like JSON, Google integrations, or complex data processing. It’s absolutely up to you – as a conversation designer.

To help you get some insights on what exactly went wrong, there is a system attribute $_last_error. It will always contain a textual description of the last error that happened in the chatbot conversation with that specific user. You can display it to the user with a TEXT block, or send an error notification to one of your bot admins (either on Messenger, with SMS, or in e-mail).

Pre-defined _error skill

If there’s nothing connected to the ERROR exit in a block, and something goes wrong when this block is executed, the system will trigger an _error event. By default, it will launch the “_error” skill that is available in every virtual assistant you create. This skill will display a generic notification to your chatbot user (with a button to restart the bot) and will send an email notification to your account email.

Please note that these email notifications are limited to one per hour. This is done to prevent your mailbox from going crazy if something is broken in the bot and there are thousands of users experiencing the error simultaneously.

Notice the use of the $_last_error system variable. When this skill is triggered, your users will see something like this:

And in your mailbox, you will find an email like this:

Notice that it contains a reference to the skill and block that caused the error. Use this information to debug your conversation and prevent this from happening in the future.

You’re absolutely free to customize the “_error” skill to suit your conversation style or even remove it completely.

If there’s nothing in your _error skill, and no blocks are connected to the “ERROR” exits in other blocks in your conversation automation, then on any error your chatbot will just silently fail, leaving your end-users disappointed.

Handling situations like this in a proper manner is extremely important to provide great experience to your customers!

Design your conversations wisely, focus on handling errors properly and have a great bot-building and live chat automation experience with Activechat!

Last updated