Condition and Matching selection
The condition is what causes the bot to start, jump between states, or another action.
In condition and arrow blocks, you can specify the characters/numbers/expressions/words that will cause the transition. The "Condition" field is in the block or connection editor.
For example, if you need to create a block on all possible messenger start words, you can specify the following condition: Start;Hello;Hi;good morning!;Good afternoon!
To recognize the condition, you need to define the type of comparison (the "Matching Selection" field). There are 4 types of condition comparison, let ’s tell you more about them.
The basic type of comparison. Allows you to work with transcripts, inaccuracies, skips of letters, as well as their permutations. The condition works if the strings are more than 70%.
For the condition "hello" will work the following words: helo,hillo,gello
This comparison uses permutations for strings up to 4 words long.
For the phrase "Thank you" will work the following condition: tank you;than u;thank u
A powerful type of comparison that will make a human-like consultant.
For this type of comparison, each word of the condition must be in the user-specified string. In any order, anywhere.
For the condition of "hello, man" will work the following condition: "I want to greet this wonderful person"
This comparison type also uses the "Strings not to be answered" field. This field works the same as the condition field, only vice versa, if the condition of the field "Strings not to be answered" works, the general condition does not work.
An additional condition can be added also through a semicolon, but what if one of several word variants is needed? For example, to process one condition of the phrase "I have no Internet, I have no computer, my computer is broken." Obviously, there’s a lot of shortcuts for nowhere. That’s what the OR syntax is for. To specify one of several equivalent keys, all of them should be placed in parentheses and separated by the symbol of a vertical line.
For example: the condition (tare plan |tariff) (pereit|plug|menit|namen) will work on questions: Hello, how to connect a new tariff. How to change the plan.
Consider the condition. (tare plan |rate) says that the line should be tare and plan OR tariff AND AT THE SAME TIME transfer OR PLUG OR MENIT OR SUBTYPE
A few other examples, they’re intuitive.
my password (kab|lk)
(forgot|reset|wowst|remember|adopts|wrong|wrong|not remembered) password
(I cannot| can not) (Recover|Change) password
login in the contract;(rub|lost|where lies|don’t know|where| do not find|no) dogs
(suspended|zablok|block|off) (services|inter|internet|written off) (saved|saved) den; put on pause;leave
autopay;pay;pay;requisition boards;connect boards
Everything is simple here. The condition works only if there is a complete match of the input line and the condition.
Regular expressions are a condition by which a bot can check the format of the input data (for example, that a person has entered a phone number instead of something else)
When collecting data, the user often enters not what he is asked to enter. I will provide a typical scheme to check the correctness of the input of the phone number. In case the user has not entered the phone number, the bot will ask him to repeat the input
From the block asking for the phone number there are 2 connections. One without the condition, and the second with the condition of regular expression of the Russian phone number:
A connection to a condition just adds it to the request and will work only when the correct phone number is encountered. The second connection will work in all other cases because it has a lower priority. On the second connection the user will be told that he entered incorrect data and on the transition with the timer will send back to enter the phone number.
A list of useful regular expressions can be found at.