> ## Documentation Index
> Fetch the complete documentation index at: https://docs.botflow.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Flow builder

> How to assemble a bot's scenario: blocks, conditions, arrows, messages, media and buttons.

A bot in BotFlow runs on blocks. Each block is a step of the scenario: it sends a message and waits for the
subscriber to write or press something. From there the bot follows arrows to the next block, reacting to the
subscriber's words, button presses and tracker events. The schema is assembled with the mouse on the canvas of the
"Flow builder" section, and no code is needed.

> [!NOTE]
>
> A new bot arrives with a ready starter funnel: a "Start condition" block on the `/start` command is already
> connected by an arrow with a 3-second delay to a "Dialog state" block. Fill the "Dialog state" with your welcome
> message and build the schema onwards from it.

## Block types

There are seven block types in all. Each is responsible for its own kind of step.

> [card] Start condition
>
> The entry point into the funnel. It fires when an incoming message or event matched its condition. Such a block must have at least one condition, otherwise it never starts.

> [card] Dialog state
>
> An ordinary step of the conversation. It sends a message and waits for an answer, then leads on by arrows. It never starts itself: you can only get into it by an arrow, by a timeout, through the "Move to block" action or from a campaign.

> [card] Fallback
>
> The backup block: checked last. It answers "help", "menu" or "cancel" anywhere in the funnel and does not knock the subscriber off their current step. To actually lead them onwards, add the "Move to block" action. You can also send somebody into this block deliberately: with an arrow or a branch of a "Condition" block. Then it becomes an ordinary step for them and they follow its arrows.

> [card] Condition
>
> A split by the subscriber's data: tags, deposits, country, variables. It checks branches top to bottom and immediately leads the subscriber down the first matching one. It sends no message of its own and waits for no answer. More below.

> [card] A/B test
>
> Splits subscribers between several paths in the percentages you set: 50/50, say, or 70/30. It sends no message of its own and waits for no answer, just like "Condition". The shares you set hold even on small traffic. More below.

> [card] AI operator
>
> Hands the conversation to the virtual operator. The block has no ready text of its own: the model writes the reply. The persona, model and language are configured on the [AI operator](https://docs.botflow.cc/en/ai-operator.md) page, while the block itself holds the "Block goal" and the "Message first on entry" toggle.

> [card] Draft
>
> A placeholder. It does not fire until you switch it to a working type. Handy for parking a block while keeping its settings.

> [!NOTE]
>
> The type of an existing block is changed in the right-hand panel, in the "Block type" list. The "Message",
> "Actions" and "Follow-ups" tabs stay put: switch the type back and they are in play again. The bot checks
> "Keywords" only on a "Start condition" and on a Fallback. You can fill them in on a placeholder too, to switch it
> to a working type later, and when switching to a type that does not check them you get a warning that they will
> no longer fire.

> [!WARNING]
>
> Switching to "Condition" or "A/B test" does not preserve the arrows leaving the block. For an "A/B test" they
> become paths into the same blocks and get percentages, but the firing condition and the delay are not carried
> over: the paths of an "A/B test" have none. An arrow leading into the same block, and arrows beyond the ten
> paths, are not carried over at all. For a "Condition" the arrows leave the canvas and each branch's transition
> has to be set again. Switching the type back does not bring the arrows back: that is what the "Undo" button on
> the builder's top bar or Ctrl+Z does, and only until the page is reloaded.

> [!NOTE]
>
> For every message from a subscriber the bot checks blocks in order: first the arrow out of the block the
> subscriber currently stands on, then the start conditions, and last of all the Fallback. If several blocks
> matched, only one fires: the one you added later. That is why the same words should not live in two start
> conditions, otherwise the newer block keeps overriding the older one. An "any answer" arrow is checked after the
> arrows with a specific condition. A `/start` the subscriber types is never taken by an arrow: it goes straight
> to the start conditions.

## Conditions: what a block reacts to

A condition is a line a block or an arrow uses to decide whether an incoming message matches. How exactly to
compare is chosen in the "Match type" list next to the "Keywords" field. On an arrow the same field is labelled
"Trigger condition", and the list of ready values next to it is called "Source buttons".

| Match type | What it does | Example |
| - | - | - |
| Ignoring typos and inaccuracies | Fires even with typos. This is the default type on a block, while a new arrow opens on "Contains keywords". | `hi; consultation; buy` |
| Contains keywords | Looks for a word or phrase inside the message, case-insensitive. Understands `(A\|B)` groups. | `buy; price; (plan\|tariff)` |
| Exact match | The message must match in full, case-insensitive. | `Start` |
| Regular expression | A search by regular expression, case-sensitive. In a block condition `;` splits alternatives, in an arrow condition the expression is taken whole. | `^(hi\|hello).*` |

The grammar is the same for a block condition and an arrow condition, except comparing a variable: that works
only in a block condition.

* `;` separates alternatives and works as OR: `buy; pay; order`.
* A command such as `/start` or `/help` with the "Exact match" and "Ignoring typos and inaccuracies" types also
  fires with a parameter after it: `/start promo`. If another block matches the whole message, such as "Exact
  match" `/start promo`, that block fires.
* `(A|B)` groups words in keyword mode: `(plan|tariff) (change|switch)`.
* `{{ }}` substitutes the subscriber's data right into the condition. You can simply write a variable as the
  condition: it substitutes its value, and the block fires if the incoming message matched it.
* A variable can be compared: `{{ status }} != paid` or `{{ price }} > 100`. The operators are `==`, `!=`, `>`,
  `>=`, `<`, `<=`. For `==` and `!=` the comparison is a case-insensitive string one, for the rest it is numeric.
* Alternatives in one field can be mixed with `;`: `buy; {{ vip }} >= 5; order`.

> [!NOTE]
>
> There is no separate AND in the grammar. Several alternatives through `;` also work as OR: the block fires if at
> least one matched. Only the "AI operator" block understands the meaning of a message; an ordinary arrow compares
> the text literally. Splitting subscribers by their data with AND and OR, for example "had an FTD and country is
> RU", is what the "Condition" block does (see below).

> [!NOTE]
>
> `{{ tag }}` is the start parameter from the bot's launch link: if the subscriber followed
> `t.me/your_bot?start=123`, then `{{ tag }}` becomes `123`. The value is fixed once, on the first `/start`. So a
> start block with the condition `/start; {{ tag }}` catches both a plain command launch and a launch with a
> parameter from a link.

> [!NOTE]
>
> An empty condition field means "any message from the subscriber". If, however, the condition is only a variable
> and the subscriber has no value for it, such a condition matches nothing.

## Arrows and timeouts

An arrow (a connection) leads from one block to another. To join two blocks, hover over the dot at the bottom of
the first block and drag a line to the dot at the top of the second. "Condition" and "A/B test" have no bottom
dot: their dots sit on the branches and paths themselves, see below.

Clicking an arrow opens the "Connection" panel on the right. It has the "Trigger condition" and "Source buttons"
fields, the "Wait for any subscriber reply" toggle and "Timeout before transition". What you fill in here
is what decides how the arrow fires. The arrow's label on the canvas shows its condition and the timeout you set,
and hovering shows the type name: "Auto transition", "On message", "On button press" or "After timeout". The last
two items in the list below are not separate types but combinations of settings.

* **Auto transition.** An empty arrow with no timeout. It fires right after the block sent its message and does not
  wait for the subscriber. If several such arrows leave a block, only one fires and you cannot choose which: keep
  one per block and make the split with a "Condition" or "A/B test" block.
* **On message.** Fires when the subscriber writes text matching the "Trigger condition".
* **On button press.** Catches a click on this block's Callback inline button. You don't pick this arrow type
  directly: insert the button you need into the arrow's condition from the "Source buttons" list, and the arrow
  becomes "On button press" by itself.
* **After timeout.** An empty arrow with a timeout fires on a timer from the moment of entering the block. You set
  the delay in the "Timeout before transition" field in seconds, minutes, hours or days. The subscriber's answer
  does not cancel the timer: if the person answered and stayed in the same block, the transition still happens.
* **On a condition with a timeout.** When an arrow has both a "Trigger condition" and a timeout, the countdown is
  started by the condition matching. While the subscriber has not written anything matching, the timer stands still
  and no transition happens. After a match the transition happens after the set time.
* **Wait for any subscriber reply.** The arrow passes on any answer, text or click, without checking a
  condition. It never fires on its own and is checked last, so it does not override arrows with a specific
  condition. A timeout combines with this mode: the countdown starts AFTER the subscriber's answer, and the
  transition happens the set time after it. If the subscriber stays silent, no transition happens at all.

An album the subscriber sends counts as one answer: the arrow fires once, and every photo and video of the
album is saved in the conversation.

A timeout is a delay AFTER the arrow fires, and what starts the countdown depends on the arrow itself:

| What is set on the arrow | The countdown starts |
| - | - |
| a timeout only | from entering the block |
| "Wait for any reply" and a timeout | from the subscriber's answer |
| a firing condition and a timeout | from the condition matching |

> [!NOTE]
>
> The hint under the "Timeout before transition" field always shows which of the three cases you ended up with.

> [!WARNING]
>
> An empty arrow with a timeout fires the set time after entering the block. The subscriber's messages do not
> cancel it: if they answered and stayed in the same block, the transition still happens on the timer. It only
> fails to fire when the subscriber has already moved to another block by then.
>
> If the arrow waits for an answer or checks a condition, the timer stands still until it fires. While the
> subscriber is silent or writes something that does not match, no transition happens at all. Repeated answers do
> not restart the countdown: it runs from the first firing. That is why "wait a day and remind them" is done with
> an empty arrow with a timeout into a separate block. There is no separate delay block in the builder.

## The "Condition" block: a split by the subscriber's data

The "Condition" block directs a subscriber by their data: tags, deposits, country, variables and saved filters.

Inside the block there is a list of branches. As soon as a subscriber lands in the block, the branches are checked
top to bottom and the first matching one wins: the subscriber goes straight into its block. The "Condition" block
sends no message of its own and waits for no answer. In the schema it works as a split between two funnel steps.

> [!NOTE]
>
> The block checks the data at the moment the subscriber enters it: by an arrow, by a timeout, through the "Move to
> block" action, from a campaign, or when an operator moves the subscriber into the block by hand from "Messages".
> It never fires on its own.

> [!NOTE]
>
> The "Condition" block has no "Message", "Actions" or "Follow-ups" tabs: it only routes subscribers. To apply a tag,
> send a request or write a message, lead the branch into a block where that is configured.

### How to set it up

**1. Add branches**

Press "Add condition". The order of branches top to bottom is the priority: the first matching one among those with a transition set wins. A branch can be renamed, moved up or down. There are up to 20 branches per block.

**2. Assemble the branch's condition**

The condition is assembled by the same builder as in subscribers and broadcasts: field, operator, value, AND and OR groups. The list of fields and operators is described in [Filters](https://docs.botflow.cc/en/filters.md). A saved filter can also be a branch's condition. Inside a branch the condition applies immediately: there is no "Apply" button and no subscriber counter here, and changes are saved together with the schema.

**3. Set the transition**

Choose the target block in the "Transition" field or drag an arrow from the dot to the right of the branch on the canvas. Every branch and the default branch have a dot. The list holds every working block of the bot, including the "Fallback": a branch can lead a subscriber into it too.

**4. Set the default branch**

Everyone who matched no branch goes there. It is optional: without it the subscribers who matched nothing go nowhere and stay where they stood before the split.

> [!NOTE]
>
> There are up to twenty branches in one "Condition" block. At the limit the add button switches off and a note
> about the limit of 20 conditions appears next to it.

> [!WARNING]
>
> A branch with no condition catches nobody. A branch with no transition is skipped entirely: a subscriber who
> matched it is checked further down the list and may go into the next branch or into the default one. Both are
> marked with an icon right on the block, so an unfinished split is visible on the canvas.

> [!WARNING]
>
> A branch must lead to a working block. If the target block was deleted or stayed in the "Draft" type, the
> transition does not fire: the subscriber stays on the previous step and the default branch does not pick them up.

> [!NOTE]
>
> If you delete the block a branch led to, the branch is deleted together with its condition. Subscribers are
> checked against the remaining branches and may go into the next matching one or into the default branch. If you
> delete the block the default branch led to, it is left with no transition and has to be set up again. To bring a
> deleted block back, press "Undo" in the notification or Ctrl+Z: the block comes back, the branches return to
> their places with their previous conditions, and the campaigns that led into that block lead into it again. Undo
> works until the page is reloaded. Deleting selected blocks cannot be undone, even when a single block is
> selected: the confirmation dialog warns that the action is irreversible.

> [!NOTE]
>
> When a schema is copied into another bot, conditions on tags, filters, campaigns and funnel blocks mean nothing
> there: all of those belong to their own bot. So such a branch's condition is cleared entirely, together with
> neighbouring conditions like "Made FTD" or deposit amounts, and the branch is marked as having no condition.
> Branches without such conditions are carried over unchanged. After copying, check the splits and reassemble the
> cleared conditions.

> [!NOTE]
>
> You can copy **part** of a schema too: select the blocks you need and copy them. If the selected blocks lead into
> blocks you did not select, copying does not start and you get a message about it. Add the missing blocks to the
> selection or copy the whole schema.

### Example

A subscriber reaches the "Condition" block after the welcome. The first branch, "VIP": "Made FTD" equals "Yes" and
"Deposits count" greater than three, with a transition into a block with a personal offer. The second branch:
"Country" equals RU, with a transition into the main Russian funnel. The default branch leads into the general menu.
A subscriber from RU who had an FTD and more than three deposits goes down the first branch and never reaches the
general menu. A subscriber from RU without an FTD lands in the second branch, and everybody else in the default one.

## The "A/B test" block: splitting traffic by percentage

The "A/B test" block splits subscribers between several paths in the percentages you set. It is useful for sending
subscribers to different welcomes, landings or follow-up scenarios and comparing them.

The block sends no message of its own and waits for no answer: like "Condition", it works as a split between funnel
steps. The difference is that "Condition" looks at the subscriber's data while "A/B test" simply distributes
traffic.

> [!NOTE]
>
> The shares you set hold even with a small number of subscribers: at 50/50 the first goes down one path and the
> second down the other.

> [!NOTE]
>
> A subscriber who lands in the block again goes down **the same path** as the first time: one person will not see
> both variants, and the comparison stays honest.

### How to set it up

**1. Add paths**

At least two paths are needed: while there are fewer, the block says so and does not split subscribers. Press "Add variant" and choose the block it leads to. There is another way: drag an arrow from the plus dot at the bottom of the block on the canvas, and the variant is created together with the arrow. There are up to ten paths per block; at the limit the button switches off and a note about the limit of 10 variants appears next to it.

**2. Set the percentages**

Every path has its own percentage field. The "Total" row under the list shows the sum, and the block saves only when it is exactly 100. While the sum is different you see "Changes not saved" and the block carries an icon on the canvas: the numbers you typed stay on screen but are not in play yet.

**3. Or split evenly**

The "Split evenly" checkbox removes the fields and divides traffic into equal shares itself. The share is recalculated from the number of working paths, so you don't have to fix it by hand every time there are more or fewer paths.

**4. Check the transitions**

Every path has a target block in its "Transition" field. The list holds every working block of the bot. Two paths may lead into one and the same block: that is allowed.

### Editing paths on the canvas

Each path is drawn on the canvas as an arrow, so you can work with it right there.

* Clicking an arrow or its percentage opens the "Connection" panel on the right with that arrow's percentage and a
  "Delete arrow" button.
* "Delete arrow" removes the path itself as well. Its percentage goes to the last path with a non-zero share, so
  the sum stays 100.
* If you delete a target block, the paths that led into it go too, and their percentages are distributed the same
  way.
* An "A/B test" arrow has neither a firing condition nor a delay: the path is chosen as soon as the subscriber lands
  in the block.

### When a path gets nobody

> [!WARNING]
>
> A path with zero percent gets no subscribers at all. The list notes under it that with 0% a subscriber cannot land
> in that variant. That is a way to switch a path off temporarily without deleting it.

If the target block was deleted or stayed a placeholder, the path stops getting subscribers: a note appears next to
it saying why it does not work ("Block deleted", "Block in draft"), and the arrow on the canvas becomes dashed. Its
share is **divided between the working paths** in proportion to their percentages. The percentages you typed stay in
place: switch the placeholder to a working type and the path works again with its previous percentage.

A subscriber who used to go down such a path will this time go down one of the working ones. When the path works
again, they return to it.

If no path can work, an icon appears next to the block's name on the canvas and the right-hand panel says
subscribers will not be able to land in any variant. That means subscribers will stop in this block.

### Example

In a funnel you want to compare two welcomes. After the start condition put an "A/B test" with two paths at 50
percent: the first leads into a block with a short welcome, the second into one with a long welcome. Both then
converge into one registration block. When you decide which welcome works better, set the weaker path to 0 percent:
subscribers go only down the second one, and you don't have to take the schema apart for that.

## A block's message: text, media and buttons

A block's content is configured on the "Message" tab.

### Text

A block's message supports Telegram's basic formatting: bold, italic, underline, strikethrough, monospace, code,
links, spoiler and quote. The "Rich formatting" toggle adds headings, tables, lists and sub/sup and raises the limit
to 32,768 characters in one message. It is available for text messages and switches off when media is attached to
the block: with media the basic formatting remains. The same mode exists in [Broadcasts](https://docs.botflow.cc/en/broadcasts.md). The "Show
link previews" toggle decides whether a link card is expanded. Telegram's limits: up to 4096 characters of text and
up to 1024 in a media caption.

### Media

Five kinds of media can be attached to a block: Photo, Video, Video message, Voice message, Audio. A message
can hold at most 100 files: a file past that number is not uploaded.

The platform accepts JPG, PNG, GIF and WEBP images, MP4, MOV and WEBM video, MP3, M4A and OGG audio: these are the
formats Telegram shows as media rather than as a file. A file in another format is rejected by the editor at
selection time, with a hint about what can be uploaded. A photo from an iPhone in HEIC cannot be uploaded, save it
as JPG.

* Several photos and videos go out as one album. Voice messages, audio and video messages are sent as separate
  messages.
* A video message is sent without a caption, so it cannot be combined with text in one block. As soon as the block
  has text, the "Video message" option in the "Send as" list becomes unavailable with a hint that a video message
  cannot have a caption, and a video message already chosen switches to "Video". If you need both text and a video
  message: keep the video message in a block without text and send the text from the previous block.
* An album is sent without buttons. While a block has two or more photos or videos, buttons are unavailable, and
  the "Remove the subscriber's reply keyboard" toggle is marked as unavailable with an album: it cannot be ticked,
  though one already ticked can be cleared. Voice messages, audio and video messages do not group into an album, and
  buttons work with them.
* When you upload a square video up to 60 seconds long, the bot sends it as a video message by default. The type can
  be switched in "Send as" right on the file, and the bot sends it as the type you chose.

> [!NOTE]
>
> A file is uploaded straight into the block. An external link or a file path cannot be used.

### Inline buttons

Each inline button takes its own row. The button type is picked with a switch:

* **URL.** Opens a link.
* **Callback.** Caught by a scenario block on a press.
* **Copy.** Copies text to the subscriber's clipboard, a promo code for example.
* **Insert text.** Puts prepared text into the subscriber's input field, so all they have to do is send it.

A button can be given a style: "Regular", "Primary", "Success", "Danger" (in the button menu they are marked with
coloured dots). `{{ }}` substitution works in a button's text and value, for example `{{ click_id }}` in a link.
Telegram's limits: a callback up to 64 bytes, a link up to 2048 characters, copied text up to 256.

> [!NOTE]
>
> **How a button leads onwards.** A Callback button is caught by a scenario block by its value, the text you typed
> into its callback. There are two ways to catch a press:
>
> * With an arrow from the same block: insert the button into the arrow's condition from the "Source buttons" list,
>   and the value is filled in with one click.
> * With a separate "Start condition" block whose "Keywords" hold the same callback value. Such a block catches the
>   press from anywhere in the funnel, even if the subscriber has already left the block with the button.

> [!NOTE]
>
> You cannot set your own reply keyboard (the ordinary buttons under the input field) in a block; a block works with
> inline buttons. There is only the "Remove the subscriber's reply keyboard" toggle: it hides a reply keyboard the
> subscriber received earlier.

## Moving a schema to another bot

The "Copy to bot…" item in the "…" menu moves blocks from the current bot into another one. Two modes are available.

| Mode | What it does |
| - | - |
| **Add to the existing schema** | The copied blocks appear alongside what is already in the target bot. |
| **Replace the schema** | The target bot's blocks are deleted and replaced by the copied ones. |

> [!WARNING]
>
> "Replace the schema" deletes everything that was in the target bot. Before deleting, the platform creates a
> snapshot of the schema, so you can roll back through "Version history" in the same menu.

You can copy part of a schema too: switch on the block selection mode, mark the ones you need and choose "Copy to
bot…". Transitions between the copied blocks are preserved, while transitions to blocks that stayed in the source
bot do not appear in the copy.

## Version history

The "Version history" item in the "…" menu opens the list of schema snapshots. A snapshot is created automatically
before a schema replacement and is kept for 30 days. A rollback from a snapshot itself creates another snapshot, so
you can return to the state before the rollback too.

> [!TIP]
>
> This is the only way to bring back a funnel that was accidentally replaced or broken. If something went wrong,
> start here rather than rebuilding the schema.

## Working with several blocks

The selection mode is switched on with the button on the canvas ("Enable block selection mode"). In it:

* blocks are marked by pressing them, and the selected ones are highlighted;
* **"Duplicate"** creates copies of the selected blocks next to them;
* **"To clipboard"** copies the selection so you can paste it into another bot's schema;
* an individual block's panel has "Copy block ID": that identifier is what you use when a block is named in an
  external API request.

## The builder on a phone

On a phone the builder opens in a simplified form: instead of the canvas there is a list of blocks you can open and
edit. At the top there is a "Pinned" group: a block goes into it through the "Pin for quick mobile access" toggle in
its panel. That way the blocks you edit often (texts, split conditions) stay at hand while the rest of the schema
stays out of the way.

## Actions after sending

The "Actions" tab configures what happens after the block has sent its message. Four actions are available:

* **Add tag.** Marks the conversation with a tag. Tags are created and managed in [Tags](https://docs.botflow.cc/en/tags.md).
* **Remove tag.** Removes a tag from the conversation.
* **Move to block.** Changes the subscriber's current position and does not send the target block's message. The
  subscriber's next message is checked against the target block's conditions, and an arrow that fires some time
  after entering a block starts its countdown from the moment of the move.
* **Send API request.** Sends a request when the subscriber reaches the block. A target switch picks one of two
  modes, see below.

> [!WARNING]
>
> "Move to block" leads only to a working block: a placeholder in the "Draft" type is not offered in the target
> list. If the target block was deleted or switched to "Draft" after the action was set up, the move does not fire
> and the subscriber stays where they are.

> [!NOTE]
>
> If you delete the block an action led to, the action itself stays but its target is cleared: choose it again.

> [!NOTE]
>
> If the block's message did not reach the subscriber (for example, they blocked the bot), the block's tags and
> API requests still run. "Move to block" does not fire in that case: the subscriber stays where they were.
> The same goes when Telegram has not confirmed sending the block's message: it may have arrived, but BotFlow does
> not know, and in the conversation its reason is "Telegram has not confirmed sending".
> If the subscriber gets into this block again within a day, for example an operator moves them there, the API
> requests already sent do not go out a second time.

### Send API request

The action fires at the moment the subscriber reaches the block. The target is chosen in the target list, and the
fields appear after the choice.

* **External URL.** Sends a request to your address at a partner or a third-party service. The method is picked with
  the GET and POST buttons under the address field. Variables from the list are substituted into the link on
  sending, for example `{{ click_id }}`. The request goes out once: if the address does not answer or answers with
  an error, it is not repeated. For money postbacks to an affiliate use
  [S2S Postbacks](https://docs.botflow.cc/en/s2s-postbacks.md): it keeps a delivery log and is built for amounts.
* **Another bot.** Sends a callback into another bot of yours. Only a bot where you have the manager role can be
  chosen. In the target bot the callback is caught exactly like an inline button press: by an "On button press"
  arrow or by a start condition with the same value (see "Inline buttons" above). The value must match the condition
  in the target bot exactly, up to 256 characters. The subscriber does not see this message, and the callback
  creates no new conversation.

  The **"Wait for the subscriber in the target bot"** switch is on by default. With it the callback is
  not lost even when the person does not exist in the target bot yet: it fires as soon as they message
  the bot, and waits for up to 14 days. With the switch off, a callback without a subscriber does not
  fire.

  If the callback matched no condition, nothing happens: the step does not change, no messages are
  sent, and the subscriber's scheduled reminders stay in place.

  If the target bot is [off](https://docs.botflow.cc/en/bot-settings.md#activity), its block on this callback adds and removes tags and
  sends API requests, but sends no messages to the subscriber. The callback does not wait for a subscriber who is
  not in the off bot yet.

  Event variables are empty in the target bot: only the callback value arrives there, without the data
  of the event that caused it.

> [!NOTE]
>
> If access to the target bot is lost, the action is marked as unavailable and has to be set up again.

> [!NOTE]
>
> There is no capturing of a response into a variable and no running of your own code in actions.

## Reminders for those who went quiet

If a subscriber got stuck in a block and does not move on, you can bring them back with a reminder on the
"Follow-ups" tab. First switch on "Reminders on" and the settings appear. The mode depends on the block:

* **Prepared messages on a timer.** In regular blocks. You write the steps yourself, and the delays are counted
  from entering the block, so each next reminder has a longer delay than the previous one. For example, the first
  reminder goes 3 hours after entering. For the second one to go 2 hours after the first, set it to 5 hours. Under
  each next reminder you see how long after the previous one it goes. A reminder with a shorter delay than the
  earlier ones goes right after the previous one: the editor highlights it, and a warning sign appears on the
  "Follow-ups" tab and on the block. Reminders with the same delay go one after another. A reminder is not sent if
  the subscriber wrote last after entering the block or after the previous reminder.
* **The AI decides when and what to write.** In the "AI operator" block. The model picks the moment and the text
  itself, based on the conversation context and what is known about the subscriber, within the "no more often" and
  "no less often" settings and the reminder limit. When the AI answers the subscriber, the pause starts over.

Both modes stop reminding when the subscriber moves further along the funnel or blocks the bot.

Reminders on the "Follow-ups" tab and a reminder built from an empty timeout arrow are different mechanisms. The
arrow fires on the timer and a subscriber message does not cancel it. Reminders on the "Follow-ups" tab do take a
subscriber message into account.

## Variables

The subscriber's data is substituted into text, buttons and conditions through `{{ }}`. Variable names are written
in Latin and exactly as they appear in the list. The full reference is in [Variables](https://docs.botflow.cc/en/variables.md).

* **System:** `first_name`, `last_name`, `full_name`, `username`, `user_id`, `telegram_id`, `date_of_birth`,
  `created_at`, `tag` (the start parameter from the launch link, see above).
* **Dynamic:** filled in after a postback from an affiliate and holding the latest event's data. `click_id` (the
  identifier for affiliate links), `event.payout` (the event amount), `event.currency` (the currency),
  `event.trader_id` (the account identifier at the partner), `event.device_type` (the device type),
  `event.os_version` (the OS version), `event.link_type` (the link type).
* **Channel exit:** `event.exit_kind` (how the person left the channel) and `event.exit_at` (when), only in the
  block the exit started and in its actions.
* **Custom:** variables you create for the bot yourself. By default such a variable holds its value per subscriber,
  and the "Global" checkbox makes the value the same across the whole bot.

> [!WARNING]
>
> Variable names are written in Latin and exactly as in the list. `{{ first_name }}` works, while a translated name
> substitutes nothing. Invented tokens like `{{ name }}`, `{{ chat_id }}` or `{{ phone }}` also produce an empty
> string. The `{{ }}` braces must not be changed.

## System events and conversions

A start condition and arrows fire not only on text but on events too. Ready events are inserted into the condition
of a block or an arrow from the "System events" list under the condition field, with no typing needed:

* Blocked the bot and Unblocked the bot.
* Join request and Request approved (for the channels of invite campaigns).
* Left the channel (for the channels of invite campaigns).
* Reaction.
* Tracker conversions: Registration, Deposit, Repeat deposit, Withdrawal and other postbacks. For where those events
  come from see [Tracker](https://docs.botflow.cc/en/tracker.md).

An event fires only on an option of the condition that matches its name exactly. The match type, regular
expressions and variables do not apply to an event: a `.+` condition or a variable like `{{ status }}` does not
catch it. Conversely, a subscriber's message is never compared with an option that names an event. Text and events
can be mixed in one condition with `;`.

There is one exception: an empty condition field of a block. It means any message from the subscriber and, besides
messages, catches the events the subscriber caused: "Unblocked the bot", "Join request", "Request approved" and
"Reaction". An empty field does not catch "Blocked the bot", "Left the channel" or tracker conversions.

> [!WARNING]
>
> An event does not start an arrow's timeout. An arrow with a timeout does not take an event: it goes on to the
> "Start condition" and "Fallback" blocks. To have an event follow an arrow, remove the arrow's timeout; the arrow
> panel reminds you of this under the "Timeout before transition" field. A "Wait for any subscriber reply" arrow
> does not catch events.

The "Left the channel" event fires when a person leaves the channel of an "Invite link" campaign where the bot is an
administrator: they leave by themselves, or the channel administrator or Telegram itself removes them. The event fires
only for the bot's subscribers, that is people who have written to the bot or sent a join request to a channel where
the bot is an administrator. Exits of other channel members run no blocks. The block's message reaches only people who
have written to the bot themselves. For people removed by an administrator the
campaign's "Don't message people removed from the channel" checkbox turns it off, and the bot does not write to
people removed by Telegram itself. People the message reached are moved to this block by a "Start condition" block
with the "Left the channel" condition, and their reminders are cancelled; a Fallback with this condition runs without
changing the subscriber's step. For everyone else only the block's tags and API requests run, an
AI block does not start a dialog with them, and the subscriber stays on their step.

When an administrator removes many people from the channel at once, the blocks for their exits run gradually,
sometimes for many hours: the bot keeps answering everyone else quickly. Only the tags and the "External URL" API requests run, with no message and no move, when Telegram itself
removed the person or an administrator removed them while the campaign has the
"Don't message people removed from the channel" checkbox on, when the exit waited more than a day, when after the exit
the person managed to write to the bot or move further along the funnel, or when the bot is off. When the person
joined the channel again before the block for their exit ran, only the "External URL" API requests go out. The
"Another bot" request is not sent in these cases. If the exit leads to a "Condition" or "A/B Test" block, the path is
chosen as usual, and the tags and API requests of the block it leads to run; "A/B Test" sends the person down their
earlier path if they have passed this block before, and remembers a new path for their next entries. If the first
message for the exit did not go out because of a Telegram pause or a connection failure, and nothing for the exit had
run before it, the exit runs again later in full, message included. For a subscriber you blocked in the
chat, the block for their exit does not run: no message, no tags, no API requests.

The `{{ event.exit_kind }}` and `{{ event.exit_at }}` variables in such a block describe the exit itself (see
[Variables](https://docs.botflow.cc/en/variables.md)); the other `{{ event.* }}` variables take the data of the latest postback. The event sees
only the exits Telegram reports to the bot: when Telegram removes accounts from a channel by itself, the subscriber
count of the channel in Telegram can fall more than the platform shows. When the campaign has an exit block chosen,
that block runs for people who joined by its link (see [Campaigns](https://docs.botflow.cc/en/campaigns.md)).

## Example: a small funnel

**1. A start condition on /start**

Create a "Start condition" block. In the "Keywords" field type `/start`, and in the "Match type" list choose "Contains keywords" (the default is "Ignoring typos and inaccuracies"). In the message, say hello: `Hi, {{ first_name }}!` and add two Callback inline buttons: "Catalogue" and "Ask a question".

**2. Split the subscriber by buttons**

Drag two arrows from the start block: insert its own button into each one's condition from the "Source buttons" list. Lead one arrow to the "Catalogue" block and the other to the "Question" block.

**3. The «Catalogue» state**

Create a "Dialog state" block and send a photo and a description in it. On the "Actions" tab add "Add tag", for example "Viewed the catalogue", so you can collect those subscribers into a broadcast later.

**4. A Fallback on «help»**

Add a "Fallback" block with the condition `help; support` in "Contains keywords" mode. It answers with a hint anywhere in the funnel and does not knock the subscriber off their current step.

**5. A reminder by timeout**

From the "Catalogue" block drag an "After timeout" arrow of 1 day into a separate reminder block. If the subscriber writes nothing within a day, they get a gentle nudge. A reply does not cancel the timer: the reminder is skipped only if the person has moved to another block by then.

> [!TIP]
>
> The schema saves itself, and the status is visible in the header ("Saved"). The easiest way to check a funnel is
> live: open the bot in Telegram and send it `/start`. All of a bot's conversations are collected in the Messenger
> (called "Messages" in the bot menu).

## What's next

> [card] [AI operator](https://docs.botflow.cc/en/ai-operator.md)
>
> The persona, model and language of the virtual operator for the "AI operator" block.

> [card] [Bot settings](https://docs.botflow.cc/en/bot-settings.md)
>
> The name, description and about text subscribers see in Telegram.

> [card] [Messenger](https://docs.botflow.cc/en/messenger.md)
>
> How an operator takes a conversation over by hand and hands it back to the AI.

> [card] [Broadcasts](https://docs.botflow.cc/en/broadcasts.md)
>
> Mass messages by subscriber tags and filters, with rich formatting.

> [card] [Flow builder API](https://docs.botflow.cc/en/api-konstruktora.md)
>
> Starting a funnel with a callback and reading subscriber data by API key from your own services.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.