# Collect Data

Have the agent gather custom details in the conversation or with a form widget, and review every submission.

## Overview

Collect data saves the details you define, such as a team size or budget. In Fields, choose how they are collected. With Conversation, the agent asks for what is missing in its own words and never invents a value. With Widget, the customer fills in a form widget you build in Build → Widgets. The action saves one entry once every required detail is in. Entries appear in Activity → Collected data.

## Set up the action

1. Open Build → Actions, choose Create action, then Collect data.
2. In General, enter an Action name.
3. Write When to use instructions that explain when the agent should collect this data, or turn on Only use in procedures to run it only as a procedure step.
4. Continue to Fields.

## Collect in the conversation

Choose Conversation under How should data be collected?. Each field has a Name, a Type (Text, Number, Email, Date or Boolean), a Description and a Required setting. The agent reads the description to know what to ask for, so describe the value and its format. Required fields are always asked for; optional ones are saved only when the customer shares them. An action can have up to 20 fields, and field names must be unique.

> **Ask only for what you use**: Every field adds a question to the conversation. Avoid collecting sensitive data unless your policies allow it.

## Collect with a widget

1. In Build → Widgets, build a widget with a Form and named inputs: Input, Textarea, Select, Radio group, Checkbox or Date picker. Each input's name is a field name: a Collected data column and a key in customFields.
2. In the widget's Functions, add a function of type Submit to action and set it as the form's submit function. Use its On success handler to show a thank-you state or to dismiss the widget.
3. In the action's Fields, choose Widget, then Add widget and link it. The inputs the widget collects are listed with their type and whether they're required.
4. Save the Fields step. The action keeps the widget as it was when you saved; after you edit the widget, save the action again to use the new version.

> **Other channels**: The widget shows in the chat bubble and help page. On other channels, like WhatsApp and Instagram, the agent asks for the widget's fields in the conversation instead.

## Destinations

| Destination | Behavior |
| --- | --- |
| Webhooks | Each submission is sent as a POST request with the body {eventType, chatbotId, payload}: eventType is <action name>_collect_data.submit and payload holds conversationId and customFields. Requests are signed with the webhook's secret. |
| Email notification | Sends your team an email with the collected values for each submission. |

## Choose channels and enable

Select the channels where the action can run, save, then enable it from the editor header or with Save & enable.

## Review collected data

1. Open Activity → Collected data.
2. Pick a date range; the last 30 days are shown by default.
3. Each row shows the action, a View link to the conversation, one column per field and when it was submitted.
4. Select rows to export them as CSV or PDF, or to delete them.

## Test as a customer

1. Start a conversation that matches When to use.
2. With Conversation, answer only some of the questions and check the agent asks for the missing required details. With Widget, check the widget appears, then submit it with a required input left empty.
3. Give the remaining details or submit valid values, and confirm the conversation continues. A submitted widget stays in the chat, read-only.
4. Check the entry in Activity → Collected data and at your destinations.

## Related guides

- [Collect leads](/docs/user-guides/actions/collect-leads)
- [Custom forms](/docs/user-guides/actions/custom-form)
- [Testing and publishing](/docs/user-guides/actions/testing-and-publishing)
