Skip to content
ChatterfyHelp Center
HomeGeneralCRMAI ManagerTrackerPlatformsFAQUpdate log
Основы и возможности
Подключение AI
Внутреннее устройство
Промпты и переменные
Bot Variables in AI Prompts
Prompt Patterns
  1. AI Manager
  2. Промпты и переменные
  3. Bot Variables in AI Prompts

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

Updated August 30, 20265 min
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 Fields
Variables 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.
  1. 1

    AI Settings

    AI Settings — detailed breakdown
    Global 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.
  2. 2

    AI Reply — Reply Addition Info

    AI Reply — detailed breakdown of the step
    Reply 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}}%
    Step block details — AI Reply — detailed breakdown of the step.
  3. 3

    Send Message

    Send Message
    Text and inline buttons use the same macros — a single source of truth for AI and broadcasts.
    Message text and, if needed, inline-button URLs — see Send message — sending a prepared message.
    Welcome! Register here: {{variables.regLink}}
    Need help? {{variables.supportLink}}
    Our Telegram channel: {{variables.channelLink}}
  4. 4

    Webhook

    Webhook
    URL and environment parameters (staging/prod) can be conveniently moved to variables. Details for the screens are in the product documentation.
    In the URL or Webhook body, 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.

Check the case and name, absence of spaces, and macro support for the field in your version. A common cause is a typo or using a field where substitution is not enabled.

Change the Value in Bot Variables — reusable values. Interface caching for the lead is usually not required — the next send will use the new value.

Variables are static values that you set manually (or update through an integration, if the product supports that). Perform “on-the-fly calculations” through Webhook, lead fields, and subsequent substitution in Reply Addition.

Usually no: variables are tied to a bot. Duplicate the values or use a common process for updating multiple bots.

Depends on the product version. Extremely long strings bloat the prompt and token cost — for huge texts, a link to a document and one variable with a URL are better.



Related

Related
The cards lead to related materials on AI Settings, steps, and bot setup.
AI Manager — overview
What AI Manager is in Chatterfy , what layers it has (Settings, Reply, Routings, Recognition, Models, Variables), and which articles to start with. AI Manager is an overview help section about artific
AI Models — Complete Guide to AI Models in Chatterfy
Here you select the models for generating replies and routing, as well as an approximate estimate of the conversation cost. The quality of your bot’s overall performance depends on the model you choos
AI Recognition — media processing
AI Recognition — media processing with AI AI Recognition is a feature inside Automation & AI that allows AI to process the user's media files. AI can work with: voice messages; photos; video note; ima
AI Routings — semantic routing
The AI Routings step is fuzzy routing. It is connected after AI Reply and routes the lead to different next steps depending on the meaning of their reply. Conditions are described in natural language;
What AI Can Do in Chatterfy
What AI can do in Chatterfy AI does not replace the flow: it works within the bot logic you have already configured and helps handle routine tasks, rather than “inventing a product from scratch”. If y
How to improve AI quality
How to improve AI quality Iterative tuning: prompts, A/B, model selection, measurements. The “observe → hypothesis → adjustment → measurement” cycle is the only way to avoid turning tuning into random
AI Settings — detailed breakdown
⁠ AI Settings is a Flow section where you configure AI behavior inside the bot. This is where you define who the bot is how it should respond what it is not allowed to do which language it uses which

Was this article helpful?

NextPrompt Patterns

On this page

  • Why Variables are needed
  • Variables and Custom Fields
  • Creation and syntax
  • Where to use
  • Shorten the link
  • Scenarios by niche
  • Antipatterns
  • FAQ
  • Related