Tracking code installation
Tracking page visits
Intents and Entities
Building Dialogflow agent and connecting to Activechat
Sending user input to NLP engine
Triggering bot skills by intents and events
Working with entities
NLP best practices
Sending order updates
Correct handling of events and contexts is crucial for building a quality human-to-computer dialogue. We’ll get back to contexts in another article about NLP capabilities, so let’s discuss events for now.
Activechat Bot Architect uses event-based flow model. This gives you extreme flexibility in flow design. When any external or internal event is triggered, the bot can react with specific blocks and skills, which are parts of the flow.
Events in Architect are differentiated by their names and can be divided into three categories:
There are two event blocks currently in Activechat – SEND and CATCH. SEND block is used to broadcast (generate) events, while CATCH blocks are used to “catch” these events and trigger certain parts of bot flow.
Each event can have a set of parameters which are being sent together with this event and can be read by CATCH block. For example, each START event contains payload parameter where ref-link or deep-link is stored.
Every CATCH block is constantly listening to the events flow in the bot, looking for the ones with specific names (and optionally – with a specific parameter value). When is broadcasted by SEND block in any of the bot skills (or generated in the system), this CATCH is passing control to the connected blocks. Lets learn some event blocks, sending, catching events.
This block is used to send (generate) events. It does not break the flow and is just firing the event with name and parameters specified. Other parts of your bot can “catch” this event and trigger dialogue branches or “skills” that will react to this event. The flow continues immediately to the next connected block (if there are any) after broadcasting the event.
As seen in the example above, events are handy when you start connecting complex skills into bot menus. You can put the whole “Order pizza” functionality in a skill, and then just call that skill with SEND block when user is pressing “Order pizza” button. The same event can be tied to “Order pizza” intent in natural language understanding module so that user can start it with free-form speech. Note how order counter (we’ll get to DATA blocks soon) is updated every time “ORDER” event is sent.
Scope for event can be SINGLE USER or ALL USERS. “SINGLE USER” means that only current bot user will get this event. Events sent with scope “ALL USERS” can be caught by all users of your bot. This can be useful if you’d like to establish communication between your users through the bot – for example, to make a dating service.
This block is used to “catch” specific events and trigger flows that should react to this event. Every skill in your bot should start with a CATCH block so that this skill can be triggered by 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 bot started with different Facebook ads, for example. If parameter value is different from the filter, CATCH block will not be triggered by event even if event name is the same.
Every CATCH block that you add to your bot creates specific “slash” command in the bot.
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 Visual Bot Architect you can create those commands in every connected messaging channel, including Facebook and Twilio.
Don’t forget to use @BotFather if you want to add these slash command to a list of bot commands in Telegram so that they will be available when user types “/”. List of commands is available in “Edit Bot -> Edit Commands” menu of @BotFather.
NB Pay attention!
Event-based model is very flexible and can be used to make various parts of communication flow run independently and in parallel. This is great if you need a complex bot, but can lead to conflicts and other issues.
Try to avoid “schizophrenic” models that will try to communicate with your user in different flows at the same time. Good planning of your conversation flow and events framework is a key here. We’ll get back to this topic in more detail in “Conversational design best practices” section.