Collecting data
Collect validated answers from customers in a chatbot with the Form node, save them to a data store, and choose the right tool for USSD and the web.
In this guide you build a chatbot registration: the bot asks a few questions, checks each answer, shows a summary, and saves the result to a data store. At the end you will see how to collect the same data over USSD or on a web form.
Pick the tool by where your customers are:
| Customers reach you on | Collect with | Answers land in |
|---|---|---|
| WhatsApp, web chat, Telegram and other chat channels | Form node in a chatbot | state.<Answer set name>.<key> |
| A USSD short code | One Menu per question, each with an Output variable | state.<Output variable> |
| A link, QR code or website | Form Trigger in an automation | state.form.<key> |
Before you start, you need a chatbot project connected to at least one channel, and a data store with fields for what you collect, for example name, phone, district and farmSize.
Add an intent that starts the form
Add an Intent node, connect the Trigger to it, set Intent Name to Register, and add utterances such as register, sign up and I want to join.
Add the Form node and its fields
Add a Form node after Register. On Basic Settings, set Form Name to Registration, and under Where the answers go set Answer set name to registration.
On the Fields tab, add one field per question:
| Field Key | Field Type | Prompt |
|---|---|---|
name | Single-line text | What is your full name? |
district | Dropdown / single choice, with your districts as options | Which district do you farm in? |
farmSize | Number, minimum 0.1 | How many hectares do you farm? |
Each answer is checked against its type and limits before the next question. A wrong answer gets the reason and the question again.
On the Behavior tab, leave Confirmation on so the person reviews a summary before anything is saved. See Form for every field type and behaviour setting.
Save the answers
Connect the Form's submit handle to a Data Store node:
- Set Action to POST and choose your store under Data Store.
- Under Payload, map each field:
nameto{{state.registration.name}},districtto{{state.registration.district}},farmSizeto{{state.registration.farmSize}}, andphoneto{{requestAttributes.id}}(the person's ID on the channel; on WhatsApp, their number).
To also keep the person in your contact list, add a Contact node after it.
Confirm and handle the other outcomes
- After the Data Store node, add a Reply such as
Thanks {{state.registration.name}}, you are registered. - Connect cancel to a Reply such as
No problem. Send "register" any time to start again. - Connect failure, which is taken when a required question runs out of retries, to a Live Chat node or a Reply that explains how to get help.
Check that it worked
- Each question is asked in order, and a wrong answer is rejected with a reason.
- The summary lists all answers before saving.
- A new record appears in your data store under Data Stores in the main menu.
Troubleshooting
Collecting over USSD
USSD has no Form node. Ask one question per Menu screen: set Menu Type to Intermediary, leave Menu Options empty so the caller can type an answer, and set Output variable to store it. Check each answer with a Router and its Fallback path, then save with a Data Store node set to POST. Keep it to a few short questions: the network ends idle sessions. See Menus and sessions.
Collecting on a web form
For people who are not chatting with you, use a hosted form. In an automation project, give the Trigger node the Form trigger type (or add a Form Trigger), add your fields, and share the Production URL after you publish. Each submission starts a run with the answers in {{state.form.key}}. The Form to WhatsApp message guide builds one end to end.