Collect data action

Make the agent ask for specific details such as an order number or email, validate the answers and save them to the conversation before it continues.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

The Collect data action makes the agent ask for specific pieces of information and store them with the conversation. Use it when a request cannot be handled without details, such as an order number, a plan name or a preferred date.

Add the action

  1. Open the agent and select Actions.
  2. Select Add action and choose Collect data.
  3. Give the action a name, for example Order details.
  4. Write the description: "Use this when the customer wants to check or change an order and has not given an order number."
  5. Add the fields you need (see below).
  6. Turn the action on and select Save.

Fields

Each field describes one answer the agent must collect.

Setting What it does
Name The key the value is saved under, such as orderNumber.
Type Text, Email, Phone, Number, Date or Choice. The agent checks the answer against the type.
Required When on, the agent keeps asking until it has a valid answer.
Prompt How the agent asks: "What is your order number? It starts with the letter A."
Choices For the Choice type, the allowed answers.

Keep the list short. Three or four fields is a conversation. Ten is a form, and customers leave forms.

Where the data goes

Collected values are saved on the conversation and appear in the Activity tab. If the customer is known, you can also store a value as a contact attribute so you see it on their profile. Other actions and procedures can use the values, for example a Custom action that sends orderNumber to your API.

Developers can read collected values with the List collected data endpoint.

Test it

  1. Open Test > Playground.
  2. Start with a message that should trigger the action.
  3. Give a wrong answer on purpose, such as a short number, and check that the agent asks again.

You should see each collected field in the trace once the agent has a valid answer.

Warning: Do not collect passwords, full card numbers or other secrets in chat. Turn on PII masking in Guardrails if customers may type sensitive details.

To capture sales contacts, use Collect leads, which also triggers the lead webhook and event.

Something unclear or missing? Tell us and we will fix the page.