Keyword detection is a great way to add some basic intelligence to your chatbot. In Activechat, keyword handling is done in the “default” skill which is triggered every time the user is sending a new message to your chatbot.
When you build a new bot from one of our chatbot templates, the “default” skill will contain a standard set of blocks required to make your “Keywords” menu work. When you start feeling the limits of this menu, you are more than welcome to disable it and customize your “default” skill in the visual builder.
Switching to the visual builder
Go to the “Keywords” section in the “Bot builder” menu and toggle the switch to enable visual builder.
Keep in mind that you can always revert back to standard keywords detection by clicking the “Restore skill” button.
As said before, the “default” skill is triggered every time when the user is sending a new message to your chatbot. The only exception is when you have an active LISTEN block waiting for user’s response to a specific question. In all other cases, for example, when the bot is idle, the “default” skill will be triggered.
So, open this skill in the visual builder (you can use the link in the “Keywords” menu or find it in the visual builder tabs) and let’s customize!
Building the “default” skill
When you open “default” skill for the very first time, don’t panic! It will be full of blocks that we put there to make your “Keywords” menu work, but you can delete all of it except the very first two blocks: CATCH block that is listening to the “default” system event and SWITCH block checking if the bot should be muted for that user.
ℹ️ Quick hint: zoom the canvas out to 40% approximately and then hold Shift on your keyboard while dragging around multiple blocks with the mouse. It will select multiple blocks that you can delete with a single click (“Delete” on your keyboard or in the right-click mouse menu).
Here’s what you will need in the “default” skill to start from scratch:
The CATCH block is essential for any skill in Activechat to run – it’s listening to the event that triggers that skill (in this case – the “default” event). SWITCH block that follows is there to check the “muted” status of the chatbot for that specific user. It’s checking the $_muted system attribute and if it’s set to “true” then does nothing 😀($_muted attribute is controlled by the “_mute” system skill).
Now you’re ready to start building your own keyword detection mechanics. Use the SWITCH block to check the value of the $_last_user_input system attribute (it will always contain the last message sent by the chatbot user).
Here is a simple example of custom keyword detection that can be used to trigger specific chatbot skills on various keywords in the user’s input:
This “default” skill will trigger various other skills from the same “Marketing agency chatbot” that we have in our templates. It will work nicely with the example that we used in the “How to customize welcome message” manual, triggering the same skills that are available in the welcome message menu as buttons.
Please refer to the SWITCH block description for more info about possible options and their combinations. You can use “and” / “or” joints to build complex conditions – for example, to trigger a skill only when words “contact” and “manager” are present in the user’s message.