Home · Blog · How a chatbot collects a phone number and email: the Collect data block and input validation
How a chatbot collects a phone number and email: the Collect data block and input validation
Almost every bot has the moment it was built for: the person leaves a phone number or email. This is exactly where most people are lost — the bot asked too early, did not understand “+7 900 123 45 67” or got stuck repeating “Please try again”. Here is how data collection works in CHBT: how to ask, how to validate the format, where the answer is stored and how not to lose the person at this step.
How Collect data works
The Collect data block asks a question and waits for the answer at this step. The person writes — the bot checks the format, saves the answer and moves on through the flow. If the format does not match, the bot asks again with your text.
The block has these settings:
- Question text — what to ask: “Leave your phone number and we will call you back”.
- Input validation — No validation, Phone, E-mail or Number.
- Error message — what to reply to a wrong format: “Looks like the number is incomplete. Example: +7 900 123-45-67”.
- Attempts — how many times to ask again. 3 by default, from 1 to 10.
- Where to save — a contact field and, if needed, a variable (Save to variable).
What counts as a valid phone and email
The validation is deliberately lenient so it does not reject real people:
- Phone — digits with spaces, brackets and hyphens, with or without “+”, at least seven characters. Both “+7 (900) 123-45-67” and “89001234567” pass.
- E-mail — an address like name@domain.zone, without spaces.
- Number — any number: age, quantity, budget.
Format validation does not confirm the number is real: there is no SMS verification in the bot. For requests this is usually enough — the manager’s call back will show whether the number works.
Where the answers go
The phone and email are written to the contact card — you can see them in Contacts, in the customer card in Conversations and in CRM. Other answers — city, size, service — can be written to a contact field with your own name (Save answer to field): they appear in the Collected by bot block of the customer card and in the contact export.
If the answer is needed only within the current conversation — for example, to insert it into the next message or check it with a Condition — save it to a variable and output it as {{city}}.
When a customer leaves a phone or email for the first time, the bot owner gets an email about the new request. And an HTTP request passes the phone and email from the card to an external system even if you did not save them to a variable.
When to ask for the phone
The main mistake is asking for the number in the very first message. The person does not yet know what they will be offered and will not give the number. An order that works better:
- Value first: an answer to the question, a selection, a quote, a free booking slot.
- Then a reason to leave a contact: “To hold the slot, leave your phone and the administrator will confirm”.
- Only then Collect data.
The more specific the reason, the higher the share of people who leave a number. “Leave your phone” works worse than “We will send the quote to WhatsApp or call at a convenient time”.
How many attempts to set
After the last failed attempt the bot does not loop — it moves on through the flow without saving the answer. This protects against the situation where a person writes “no thanks” three times and gets “Please try again” over and over.
- For a phone — 2–3 attempts and a clear format example in the Error message.
- For an email — 2 attempts: typos happen, but the third time the person is unlikely to write it differently.
- After Collect data, put a Condition on the empty field or variable: if there is no answer, offer an operator or another way to get in touch instead of pretending the request was received.
Collecting several fields in a row
Name, phone, city and a convenient time — four Collect data blocks in a row. Start each next question with a short confirmation of the previous one: “Thank you, {{name}}! Now your phone”. That way the person sees the bot understood them.
If there are only a few possible answers — one of three cities, one of five sizes — buttons in a Message are more convenient than free input: fewer typos and no validation needed. You can also set suggestion chips under the input field, comma-separated, but in messengers regular buttons are more reliable.
Consent to personal data processing
A phone, name and email are personal data. Before collecting them, show a short notice with a link to the policy and, if you are going to send broadcasts, ask for consent separately. How to set this up in a flow and what the law requires — in the article “152-FZ and chatbot”, and a template for broadcast consent — “Broadcast consent”.
Common mistakes
- Expecting a “Share number” button. There is no such button in the CHBT editor — the phone is asked for as text with Phone validation.
- An overly strict example. “Enter the number strictly as +7XXXXXXXXXX” scares people off — the validation accepts a number with spaces and brackets anyway.
- No branch for an empty answer. After the attempts run out, the flow moves on — without a Condition the bot will thank the person for a request that does not exist.
- Data only in a variable. A variable lives within the conversation; anything the manager must see should go to a contact field.
- A question without a reason. Explain why you need the number — this is the main lever for the share of contacts left.
Question texts that work
The question itself affects the share of answers no less than its place in the flow. A few wordings that usually work better than “Enter your phone number”:
- “Where should we send the quote? Write your number — we will send it to WhatsApp or call, whichever you prefer”.
- “Leave your phone — the administrator will confirm the time within 15 minutes”.
- “How should we address you?” — before the phone, to make the conversation personal.
- “Write your email, the checklist will be sent there” — when there is a clear benefit for the email.
In the Error message do not scold — show an example: “Looks like some digits are missing. Example: +7 900 123-45-67”.
Data collection for different tasks
- Booking a service: name → service with buttons → convenient time → phone. The phone comes last: the person has already chosen and is ready to confirm.
- Delivery: city with buttons or text → address without validation → phone for the courier.
- A B2B request: the task in free form → company → email → phone optional. Some B2B customers are more willing to leave an email than a number.
- Selection and quiz: three to five questions with buttons → result → “we will send a selection, leave your phone”. Ask for the contact after the value, not before.
- Call back: phone → a convenient time with buttons “Now”, “After lunch”, “In the evening”.
What to do with collected contacts
A contact that sits in a card nobody looks at is a lost request. Decide right away where it goes:
- To a manager: after Collect data put Action → Notify an operator or CRM deal, so the request appears in the pipeline.
- To a segment: a tag by the request topic, for example
request-delivery, — later it is easy to filter Contacts by it and download the list as CSV. - To an external system: an HTTP request passes the phone and email to your CRM or spreadsheet.
- To a broadcast: only to those who gave consent — otherwise the broadcast will cause complaints.
Flow editorCollecting applications via chatbot152-FZ and chatbotCRM and contacts