Constants in a bot scenario
Think of your scenario as a chain of steps: each block does something and stores the result in a shared data basket. Every value has a name — so in a message you don’t guess; you drop in live data with one placeholder in curly braces.
Example constants (names may differ in your editor; the idea is the same):
•
•
•
Text, numbers, lists, flags — all live under clear keys and update as the dialog moves forward.
Special blocks in a template go beyond a simple substitution — they add logic inside the text:
Those blocks are processed first; then plain {…} substitutions — so templates stay predictable when you keep that order in mind.
Constants tie steps into one story: the bot replies based on what already happened in the scenario, not in a vacuum.
Think of your scenario as a chain of steps: each block does something and stores the result in a shared data basket. Every value has a name — so in a message you don’t guess; you drop in live data with one placeholder in curly braces.
Example constants (names may differ in your editor; the idea is the same):
•
{MAIN.STRING.USER_TELEGRAM_ID} — a string, e.g. the user’s Telegram ID•
{DATA.ARRAY.CURRENT_ROW} — a structured record (e.g. a table row); you can address fields by path•
{MAIN.BOOL.CONDITION_12_RESULT} — true / false — the outcome of a condition blockText, numbers, lists, flags — all live under clear keys and update as the dialog moves forward.
Special blocks in a template go beyond a simple substitution — they add logic inside the text:
{#EACH} … {/EACH} — walk an array and repeat a snippet for every item (catalog, order lines, any list).{#IF} … {#ELSE} … {/IF} — branching: one text if the condition holds, another if it doesn’t.{#DATETIME; … ; …} — date and time: take a moment from your data, shift it by days / hours / minutes, and print it as a string.{#MATH} … {/MATH} — a formula inside the message (qty × price, rounding, etc.).Those blocks are processed first; then plain {…} substitutions — so templates stay predictable when you keep that order in mind.
Constants tie steps into one story: the bot replies based on what already happened in the scenario, not in a vacuum.
❤2
