CATCH

This block is used to “catch” specific events and trigger conversation flows that should handle that event. Every skill in your bot should start with a CATCH block so that this skill can be triggered by a specific event. If you add any parameter values to the CATCH block, on catching the event it will check event parameters and start executing connected blocks only when parameter values are the same. This is handy to process various ref= links to have different parts of the bot started with different Facebook ads, for example. If the parameter value is different from the filter, the CATCH block will not be triggered by the event even if the event name is the same.

Using bot commands

Every CATCH block that you add to your bot creates a specific “slash” command in the bot.

Example:

CATCH block with “hello” event name above would create “/hello” command and this command will trigger blocks that are connected to CATCH. Use this to add commands that control your bot behavior. With Activechat you can create those commands in every connected messaging channel, including Facebook and Twilio SMS.

When the chatbot user is typing “/hello” in the conversation, the “hello” event will be triggered in the chatbot and the “hello” skill (if you have one!) will start running.

Telegram users: don’t forget to use the @BotFather bot if you want to add these slash commands to the list of bot commands in Telegram so that they will be available for autocomplete when the user types “/” in your chatbot. A list of commands is available in the “Edit Bot -> Edit Commands” menu of @BotFather.

An event-based model is very flexible and can be used to make various parts of your chatbot conversation run independently and in parallel. This is great if you need a complex bot, but can lead to conflicts and other issues.

A common issue among novice chatbot developers is using multiple CATCH blocks with the same event name. When this event is triggered, all these blocks will get control simultaneously, and multiple conversation flows will start running.

Try to avoid “schizophrenic” models that will communicate with your chatbot user in different flows at the same time. Good planning of your conversation flow and events framework is key here. We’ll get back to this topic in more detail in the “Conversational design best practices” section.

Last updated