Intents block
The Intents block defines what the client wants and directs them to the corresponding branch of the script.
Intents work as follows:
- First, you add the words clients can send as well as sample phrases and phrase templates to the Intents block.
- After that, you define how the bot should respond to:
- certain words, phrases, and synonyms for words and phrases;
- phrases built by a certain template.
- When the client sends a message, the bot will check whether the client’s phrase matches one of the intents you have added:
- If so, the bot will go to the screen the intent is associated with.
- If no, the bot will move to the screen associated with the Other intents option.
- The bot saves the client’s response if it is needed.
How to add an intent?
Create an intent
You can create your own intent based on a list of sample phrases.
-
Select Create your own intent from the block menu.
-
Write templates and sample phrases you expect to receive from the client. Click Save.
-
Associate the intent with the desired screen. If the client says or writes something that matches one of the intents, the bot will direct the client to the associated screen.
Select a built-in intent
You can also use the built-in intents we have created for you. They cover the most widespread behavior patterns such as greeting, agreement, personal data provision, etc.
You do not need to add sample phrases and templates to built-in intents because they are already included in these intents.
A part of built-in intents is placed in the User says section of the block menu. To see the whole list of built-in intents, open the More blocks submenu.
Also, you can add a built-in intent when editing the Intents block by clicking Choose a built-in intent.
Make available from any point of the script
The bot usually follows a linear script.
However, you can make the bot recognize and save the client’s responses at any moment in the conversation.
To do it, enable the Make the block available from any script point option.
The bot will react to this intent at any point of the script.
Define reaction to other intents
The Other intents option is triggered when the client writes something that does not match any of the intents.
If you do not associate the Other intents option with any of the screens, the bot will answer Sorry, I can’t understand you to any phrase that is not recognized as an intent.
We strongly recommend associating the Other intents option with some screen every time.
You can also connect this option to the same screen where the intent is placed. In this case, the bot will stay on this screen until the client writes the expected phrase.
Sample phrases
To edit the intent, click on the block. This will open the list of sample phrases the intent contains. If you use a built-in intent, it will be specified at the top of the block.
Each block of sample phrases must contain at least one phrase example that will help the bot to interpret the client’s response.
You can specify any number of sample phrases for each intent. The more examples you specify, the better your bot will understand the client.
With the help of the machine learning algorithms, the bot recognizes synonyms and word forms, and also extracts data from phrases.
For example, it is enough to specify Hello
as a sample phrase to make the bot recognize greeting in the “Hi, dear friend” phrase.
Templates
You can use phrase templates instead of sample phrases to make your bot react only to the phrases that match the template.
Templates should be added in accordance with the template syntax we have developed for natural language processing.
How to switch between a sample phrase and a template
By default, when you go to the Intents block and add new intents, they are added as sample phrases, not as templates. It is indicated by the icon next to each phrase.
To turn the sample phrase into a template, click the icon next to each phrase you want to make a template. It will change to the icon.
You can use combinations of sample phrases and templates on the same screen.
How to save the client’s response
Each client’s answer is automatically saved to the $queryText
system variable that can be later used in the script.
The answer is kept in the $queryText
variable until a new request or intent is executed.
If you want to save the answer till the end of the script, create a new variable. Assign a value of the $queryText
variable to the new variable before a new request is executed.
How to use entities when saving the client’s choice to a variable
In intents, you can use entities in order to accept and store client’s choices.
For example, create the $fruit
dictionary with apple
and pear
entities. Add a couple of synonyms for each entity.
Add a Text block with a Choose a fruit phrase.
On the same screen, add an Intents block and specify the following:
$fruit: fruitchoice
This intent will accept synonyms from the $fruit
dictionary and write the entity the synonym is associated with to the $fruitchoice
variable.
The entity can be used in the script as follows: