Home · Help · Variables and fields
Variables and fields
Variables let you address a customer by name, repeat back what they wrote, and pass that data on: to a “Condition,” to a CRM deal, or to an external system. Variables come from the “Data collection” block and the “Set a variable” action. Below: how to set up data collection, how to insert values, and where they work and where they don’t.
The “Data collection” block
The block asks a question and waits for a text reply. Settings:
- What to ask — Name, Phone, E-mail or Custom field. The first three are saved to the contact card (you’ll see them right away in “Contacts”); a custom field goes into the card’s additional fields under the name you specify.
- Question text — you can insert variables that are already known: “{{name}}, please leave your phone number for confirmation”.
- Input validation — No validation, E-mail, Phone or Number. A phone number is accepted with a plus sign, spaces and parentheses, 7 digits or more; an e-mail must match the format “something@domain.tld”.
- Error message — what the bot replies if the input fails validation: “Looks like there’s a typo in the number — please send it again”.
- Attempts — how many times the bot asks again if the format is wrong (3 by default). Don’t make validation stricter than necessary: a customer who isn’t understood three times in a row leaves.
- Save to variable — the name of a flow variable, for example
slotorphone. Without this field, the value goes to the contact card, but “Condition” and “HTTP request” won’t see it.
When a phone number or e-mail is saved for the first time, the bot owner gets an email about the new lead — no separate setup needed. A name from “Data collection” overwrites the name taken from the messenger profile.
Inserting values into messages
Curly braces work in the text of any “Message” (and in the question text of “Data collection”):
| Variable | Where it comes from |
|---|---|
{{name}} | The name from the contact card: first from the Telegram/MAX/VK profile or the widget’s pre-chat form, then from “Data collection” with the Name type |
{{phone}} | The phone number from the contact card |
{{email}} | The e-mail from the contact card |
{{slot}}, {{city}}, any name of your own | A flow variable: “Save to variable” in “Data collection”, the “Set a variable” action, an “HTTP request” response or the summary from the “Marketplace data” action |
Example: “Thank you, {{name}}! Your request for {{slot}} has been received, we’ll call you back at {{phone}}”. Variable names use Latin letters and no spaces; they are case-sensitive.
An empty value is replaced with an empty string. “Hello, {{name}}!” for a contact without a name turns into “Hello, !”. So either collect the name before you first address the person, or put the variable where its absence won’t stand out (“Request received{{name}}” won’t help — a separate sentence is better). You can check whether a variable is set with a “Condition” block and the “is set” operator.
Where else variables work
- “Condition” — the “Variable” check:
areagreater than 40,cityin the list “Moscow, Kazan”. The value must be saved with “Save to variable” — see the help article on conditions. - “CRM deal” action — a deal name with placeholders: “Booking: {{name}}, {{slot}}”. This way the manager sees what the request is about on the kanban board without opening the conversation.
- “Notify an operator” action — the notification text: “Urgent question from {{name}}, {{phone}}”.
- “HTTP request” action — all flow variables are sent to the external system in the request's
varsfield; the server's response can be saved with “Save to variable” and shown to the client. For the format, see the webhook help. - The AI agent sees the flow variables and can take them into account in its reply — for example, the city or the selected service.
Where variables don't work
- In broadcasts — only
{{name}},{{phone}}, and{{email}}from the contact card. Your own variables live inside the conversation and aren't available in the “Broadcasts” section; personalize segments with tags. - No arithmetic. “Set a variable” assigns a value but doesn't add or multiply. Quiz scores are counted with tags and a “Condition”, not with a sum.
- A variable lives in the conversation. It persists between steps, after a “Pause”, and when the flow restarts, until the conversation is closed; it won't be there in a new conversation with the same customer — unlike the name, phone, and email, which are stored in the contact card. Anything that needs to outlive the conversation should be saved as a custom field or a tag.
Ready-made examples of collecting and inserting values are in the templates “Appointment requests” ({{slot}} in the confirmation) and “Quiz bot” (a number saved to a variable and a condition on it). You can check the substitution without a messenger using the “Check flow” button in the editor.
FAQ
How is “Custom field” different from “Save to variable”?
“Custom field” saves the answer to the contact card under the name you specify — it’s visible in “Contacts” and stays after the conversation ends. “Save to variable” makes the value available to the flow: for insertion into text, “Condition” and “HTTP request”. Usually you turn on both.
Why did “{{slot}}” show up as plain text in the message?
No variable with this name is set in this conversation. Check the name in the “Save to variable” field (case and Latin letters) and make sure the data collection block comes before the message. Unknown names are replaced with an empty string, and curly braces containing spaces or Cyrillic characters aren't recognized.
Can I insert my own variable into a broadcast?
No, broadcasts support only {{name}}, {{phone}}, and {{email}} from the contact card. To send different texts to different groups, use tags and separate broadcasts.
Where does the bot get a name if it never asked?
From the messenger profile (first and last name in Telegram, name in MAX and VK) or from the widget’s pre-chat form. A “Data collection” block with the Name type overwrites it with what the customer typed.