Variables & templating

Store values per user and drop them into any text with {{var.x}} and {{user.x}}.

Variables let your bot remember things per user — a name, a score, a cart. You insert them into messages, conditions and API calls with templates: {{ ... }} placeholders that are replaced with real values when the bot runs.

Two namespaces

TemplateWhat it is
{{var.NAME}}A variable you created (e.g. {{var.score}})
{{user.FIELD}}A field about the current user, provided by Telegram

Available user fields: {{user.id}}, {{user.first_name}}, {{user.last_name}}, {{user.username}}.

Where templates work

Any field marked templatable accepts {{…}}: message text, captions, conditions, HTTP URL/body/headers, “send to chat”, and more. In the editor these fields show a Variable button that inserts a token for you — no need to memorize names.

Creating & changing variables

Set    score = 0
Add    score + 10        →  {{var.score}} is now 10
Send   "You have {{var.score}} points, {{user.first_name}}!"

Reserved variables

Some variables are filled in automatically:

  • {{var._item}} and {{var._index}} — the current item/index inside a Dynamic keyboard.
  • {{var._payment_payload}}, {{var._payment_amount}}, {{var._payment_charge_id}} — set after a successful payment.