Ask AI
English EN
Go to Watbot

How the bot chooses a reply

The bot does not search the whole scheme for a reply. It remembers which block each person stopped at and matches a new message against the outputs of that very block. Once you understand this order, it is easy to explain why the bot replied one way and not another.

The current block

Every contact has a current block — the one where the bot stopped and is waiting for a reply. Usually it is a message with buttons or a question.

Blocks that do not wait for a reply are passed right away through the "Continue" output: the bot added a tag, saved a variable, checked a condition — and moved on until it reaches a block where the person's reply is needed.

When the person presses a button or writes a message, the bot looks at the outputs of the current block, chooses one of them and follows the arrow to the next block. Now that one is the current block.

Tip

The current block is visible during testing: in the "Bot test" window, turn on "Variables and tags" — the "Block" line shows the block you are at now. See the Testing the bot page for details.

Where the conversation starts

The bot starts the scenario from the beginning — from the start block — when:

  • a person writes to the bot for the first time;
  • a person restarts the bot;
  • a person follows an additional link — then the conversation starts with the scenario chosen for the link.

A person can restart the bot on their own:

  • in Telegram — with the /start command;
  • in MAX — with the /start command;
  • in VK — with the 000 message;
  • in Viber — with the 000 message.

The bot decides which scenario opens at the start like this:

  1. If the contact has a tag that an alternative main scenario is assigned to — that scenario.
  2. Otherwise — the scenario set as the main one.
  3. If nothing has been set as the main one — the "Main scenario".

How to set the main and the alternative scenario is on the Scenarios page.

How the bot processes a message

A person is at a block with buttons and replies something. The bot checks in order:

  1. Service words. "стоп", "stop" and "/stop" unsubscribe the person from mailings — see below.
  2. A pressed button. The person pressed a button of the block — the bot follows its output.
  3. A button number. If "Answer in numbers" is turned on in the block and the person sent a number, the bot takes the button with that number.
  4. A button's text. The person typed a button's name themselves — the bot follows its output. The text must match the name in full; upper and lower case make no difference.
  5. "Any other phrase". Nothing matched, or the person sent a file instead of text — the bot follows the "Any other phrase" output.
  6. Repeating the question. If the "Any other phrase" output is not connected to anything, the bot sends the block's message once more. The person stays at the same block.

The repeat is controlled by the "Repeat question" switch in the block settings: if you turn it off, the bot stays silent in response to an unclear reply. The "Answer in numbers" and "Repeat question" switches and the reply check ("Validation") are described on the Messages and buttons page.

Block outputs: the "Delivery" and "Catalog" buttons, "Any other phrase" and "Continue"Block outputs: the "Delivery" and "Catalog" buttons, "Any other phrase" and "Continue"

Example

The "Daisy" flower shop. A person is at a block with the question "What are you interested in?" and the "Catalog" and "Delivery" buttons.

The person replies What the bot does
Presses "Delivery" Follows the "Delivery" output
Writes "delivery" Follows the "Delivery" output: the text matched the button's name
Writes "2" Follows the "Delivery" output: it is the second button, and "Answer in numbers" is turned on
Writes "How much is delivery?" Follows the "Any other phrase" output. If it is not connected — repeats the question
Writes "stop" Unsubscribes the person from mailings
The "Test bot" window: the bot repeated its question after "How much is delivery?" and answered about delivery after "2"The "Test bot" window: the bot repeated its question after "How much is delivery?" and answered about delivery after "2"

Commands that work everywhere

For phrases like "Menu" or "Operator" to work from anywhere in the bot, you do not need to add them to every block. There is the "Global menu" block for that: the bot checks its items when the reply matched none of the current block's buttons — before following "Any other phrase".

The global menu also has its own "Any other phrase" output. It fires when the same output of the current block is not connected to anything — this gives a common "I did not understand you" reply for the whole bot.

The "stop" words

The bot checks the words "стоп", "stop" and "/stop" before the block's buttons. If a person writes "stop", the bot unsubscribes them from mailings, even when the block has a button with that name. What happens next and how the person can subscribe again is on the Recipients and filters page.

Warning

Do not name buttons "Стоп" or "Stop": if a person types the name of such a button as text, the bot takes it for unsubscribing from mailings.

When the bot does not reply

  • The project owner has no Pro subscription. The bot does not guide people through the scenario. See the What is available without Pro page for details.
  • The bot is turned off. Check the "Enable bot" switch: "Settings" → "General".
  • The bot is used only for correspondence. In "Settings" → "Advanced", the "Turn the bot off and use the service only for messaging with customers" switch is turned on.
  • The bot is stopped for this person. An operator has taken over the conversation or the contact is blocked — see the Messages section.
  • The reply fit none of the outputs. "Any other phrase" is not connected to anything, and "Repeat question" is turned off in the block.

When the bot is turned off, works only for correspondence or is stopped for a person, that person's messages are still saved in the conversation — an operator can reply to them personally.

If the bot replies with something you did not expect, open the block and look at the "Execution log": it shows which message arrived and how the block's run ended.