The "Condition" block allows you to guide the user through a particular branch of the script, depending on certain conditions.

Brancing scenario by condition

The simplest block has two exits:

  • the user jumps to the branch of the script whose condition (or group of conditions) is met,

  • The user enters the second branch of the scenario when the condition is not met. This exit is marked in red.

Groups of several conditions

You can add either a single condition or groups of conditions to a block and configure whether all conditions are to be met or only one of them.

There can be several groups with conditions, each group can have up to 4 conditions.

Groups of conditions can be swapped in a block using the arrows on the left side of the group. The group is not disconnected from other blocks.

To delete a particular condition in a group, click on the gray garbage can, to delete the whole group, click on the red garbage can.

Error message

If one of the conditions does not have a script continuation, the bot will give an error to the user:

What are the conditions

Tag condition

Depending on whether a user is assigned a tag or not, he can be directed to one or the other branch of the script.

Tags can be added or removed under Settings → Tags

Condition of the channel (messenger)

The ideology of the platform is to connect all channels of communication with customers into one system and work in them according to the same scripts. However, sometimes it is necessary to arrange different script logic depending on which messenger (channel) is communicating with the user.

Condition on the value of the variables

The platform allows you to construct conditions by variables.

To do this, you must select one of the variables in the list. System (preset) and user variables are available for selection.

System variables

The system variables are presented at the beginning of the list. These variables are filled in automatically by the system and are available to each user.

User variables

User variables are located in the drop-down list after system variables. These variables must be added manually in the settings

Construct a condition on a variable

Usually a variable condition has three parts (variable, operation, and argument). For example, age is greater than 18. Here age is the variable, greater than is the operation, and 18 is the argument. The operation can be selected from the drop-down list below the variable list.

In most cases, after selecting an operation, you must enter an argument in the next input field. The exceptions are operations such as Contains Any Value and Value Not Specified. For these, the argument entry field will not be displayed.

Consider the following example: you want the bot to send appropriate content to the user based on his age. To do this, create a variable "age", select the appropriate operation and enter the necessary argument value, and then add script branches.

Random condition on a vatiable

The Condition block allows you to write complex formulas in Python using system and user variables. The result of the calculation must be a value of type bool.

For example, the age condition can be written with the formula: age > 18

Last updated