Bot Variables in AI Prompts
How to reuse links, identifiers, and constants in “AI Manager — overview” — , step , and via the {{variables.name}} macro. Shortening long URLs and common patterns. Section reference — . Here, we cove
How to reuse links, identifiers, and constants in “AI Manager — overview” AI Manager — overview — AI Settings — Bot Personality, step AI Reply — smart replies via AI, Send message — sending a prepared message and Webhook — Sending Data Out via the {{variables.name}} macro. Shortening long URLs and common patterns.
Section reference — Bot Variables — reusable values. Here, we cover practical substitution in AI and messages. Data for each lead is Custom Fields — custom fields, not to be confused with bot variables.
Where to start
Below, you’ll learn why Variables are needed, how to distinguish them from lead fields, the syntax, and common places to use them in AI and messages.
Why Variables are needed
Why Variables
A single value (link, promo code, URL) is reused in flows and prompts: editing it in one place updates all substitutions.
The same value (registration link, promo code, support URL) often appears in a dozen places across flows and prompts. Without variables, every change means manual editing and the risk of forgetting one of the nodes. With variables, you change the Value in one place, and the substitution updates everywhere the macro is used.
Variables and Custom Fields
Variables and
Custom FieldsVariables are shared bot constants. Data for a specific lead is stored in
Custom Fields and {{fields.*}} macros. Do not confuse their roles. | Bot Variables | Custom Fields |
|---|---|---|
Level | Bot | Lead |
Value | The same for all leads of this bot | Individually for each lead |
Macro | {{variables.name}} | {{fields.key}} or the syntax from the CRM help |
Edit source | Bot Settings → Bot Variables | Operator, AI Recognition, integrations, Webhook |
Rule: Variables are shared bot constants. Custom Fields are personal lead data.
Creation and syntax
Syntax
{{variables.name}} — the name exactly as in the setting, double braces, no spaces inside. A typo is often sent to the chat as text.
CRM → Bot → AI Manager — overview → Automation & AI → Bot Variables — reusable values → add a variable: name (Latin characters, no spaces, often camelCase or snake_case) + Value.Substitution:
- {{variables.regLink}}
- {{variables.support_link}}
- {{variables.promoCode}}
- Syntax requirements: double curly braces, no spaces inside, and the name exactly as in the setting. Variants such as {{Variables.regLink}}, { variables.regLink }, {{variable.regLink}} usually do not work.
Where to use
Where it is inserted
The value is inserted before sending to the model or in the message to the lead — it depends on the screen. Below is a breakdown by step type.
AI SettingsGlobal Legend, Restrictions, and Response Style — convenient for storing stable registration links, support links, and legal wording.In AI Settings — Bot Personality, Restrictions, Response Style, the value is inserted before sending to the model.Example:- You help users register on the partner platform.
- The registration link is: {{variables.regLink}}
- When user asks how to register, send them this link.
- For support questions, refer to: {{variables.supportLink}}
- Changing the partner link means updating one variable. New replies will use the new URL.
Check the current help documentation for supported macro fields: not all screens have AI Settings — Bot Personality macro substitution enabled the same way.AI Reply— Reply Addition InfoReply Addition Info is for promotions and parameters that change more often than the full legend: promotions, dates, discount.Convenient for promotions and parameters that change more often than the bot legend:- Current promotion: {{variables.currentPromo}}
- Promo code: {{variables.promoCode}} — valid until {{variables.promoExpires}}
- Discount: {{variables.discountPercent}}%
Send Message
Send MessageText and inline buttons use the same macros — a single source of truth for AI and broadcasts.Welcome! Register here: {{variables.regLink}}Need help? {{variables.supportLink}}OurTelegramchannel: {{variables.channelLink}}WebhookWebhookURL and environment parameters (staging/prod) can be conveniently moved to variables. Details for the screens are in the product documentation.In the URL orWebhookbody, variables help keep the endpoint and environment parameters in one place (staging/prod) — Webhook — Sending Data Out.
Shorten the link
Shorten the link
A long URL can be displayed in a shorter form: select a domain from the list and check tracking and combination with other macros in a test.
For a variable whose Value is a long URL, there is a Shorten the link option and a domain selection from Domains — custom domains. The lead is shown a short link on your domain with a redirect to the full URL.
Example of the original Value (tracking parameters are illustrative):
https: //partner.example/register?utm_campaign=111&utm_source=222&...
After enabling shortening, the lead may see something like:
https: //mydomain.com/qp7h3zi
Short links are usually easier to copy and look neater in the chat. The effect on CTR depends on the audience and formatting.
Important: if tracker macros ({{tracker.clickid}} etc.) and variables are mixed in Value, the behavior depends on the stage at which shortening and substitution are performed — check it on a test lead in Messenger. Не предполагайте вложенную подстановку{{variables.a}}. Do not assume nested substitution of {{variables.a}} inside {{variables.b}} without checking it in the product.
Scenarios by niche
Scenarios by niche
Ready-made ideas for names and use cases — use them as a blueprint and adapt them to your product and compliance requirements.
- Traffic arbitrage. regLink with a long tracking URL + Shorten + your domain. The same variable in Legend, Reply Addition, Send Message.
- Sales. currentPromo, promoCode, expiration date — in Reply Addition at objection-handling and closing steps.
- Support. faqUrl, docsUrl, returnsUrl — a single source of truth when moving the knowledge base.
- E-commerce. deliveryDays, freeDeliveryThreshold — delivery rules without editing every prompt.
- Info business. nextStreamStart, streamPrice — update before a new cohort.
Antipatterns
Antipatterns
Do not store personal data, secrets, or “magic” nested macros in Variables — this breaks and is unsafe.
Do not store in Variables what is individual to a lead — use Custom Fields — custom fields and field macros.
Unclear names (x,link1) — in a month you won’t be able to make sense of them. Use regLinkPocketOption,promoMarch2026.
Nested macros in a variable’s Value often do not expand. Keep values “flat”.
Secrets in Variables are accessible to anyone who can see the bot settings. Store API keys and passwords in the company’s protected mechanisms / integration secrets, not in an open Value.
FAQ
FAQ
Short answers to common concerns — expand the items below as needed.
Related
Related
The cards lead to related materials on
AI Settings, steps, and bot setup.Was this article helpful?








