Create a script

In this section, we will look at the process of creating and running our own scripts.

Script is a sequence of steps that the bot performs in response to events, such as an incoming message in a messenger, joining a group on a social network, or paying for an item in your online store.

Before reading this section, we recommend that you familiarize yourself with the basic principles of scripting.

To create a script, go to the "scripts" section through the menu on the left and click the "add script" button:

Enter a script name and click "create".

After that, you will be taken to a blank script creation screen. Take a look at the menu on the left:

  • Events are external influences that can trigger a scenario. For example, a message from a user

  • Actions are the steps that the bot performs in response to events

  • Conditions - you can set the conditions under which the logic of the dialogue can change. For example, if a person has already bought a product from you before, offer him another product

  • Variables - a list of available variables for use in scripts

  • Settings - scenario settings

Let's create a simple conversation chain where the bot will respond with the message "great" to the question "how are you?".

To do this, select "user input" in the events. An event block will be created on the scenario graph and its settings will open:

Pay attention to block settings.

You can specify the name of the event (so it will be easier to search for it on the graph), the condition for the user's message and additional settings.

Now it is enough for us to specify only the condition. We expect the user to ask "how are you". Let's add it to the message condition:

Great, now let's add the "send message" action. Select the "actions" section in the left menu and click on "send message". A block for sending a message will be added to the script graph and the settings will open:

We will consider the settings of the "send message" action in detail in other sections, but for now it is enough to enter the desired message. Write "excellent" in the message input field. After that, the script graph will look like this:

These blocks are not linked. To set the dialog sequence (event -> send message), hover over the event block. A circle will appear from which you can drag an arrow to the message send block:

The blocks are now connected. By the way, it was possible to link them through the "next block" setting in the event settings menu:

This can be convenient when the script graph is very large and it is difficult to drag an arrow from one block to another.

Last updated