# Collect leads with your AI agent > Capture a visitor's contact details as a lead, with a form in the chat or in the conversation The **Collect leads** Action captures a visitor's name, email, phone number and other details as a lead during a conversation with your QwryAI agent. It's for teams that want to turn website and messaging visitors into contactable leads and send them to a webhook or an inbox. The agent can show a lead form in the chat, or ask for the details in the conversation. Each agent has one Collect leads Action, so there's no **Action name** field. To collect several different sets of details on one agent, use [Collect data](/docs/user-guides/chatbot/actions/collect-data), which you can add more than once. **Best for:** turning an interested visitor into a contactable lead before they leave, and sending that lead straight to your team. **Common use cases:** * Capturing details when a visitor asks for a quote or a demo * Following up with someone whose question needs a person * Qualifying interest with custom fields like company name or order size * Seeing which campaign each lead came from, with [UTM hidden fields](#utm-hidden-fields) ![The Create Action gallery with the pointer on the Collect leads card.](annotated/01-card.webp "Create Action › Collect leads.") ## How to create the Action **1. Open Actions** In your [QwryAI dashboard](https://www.qwryai.com), select your agent and click **Build › Actions** in the sidebar. **2. Create the Action** Click **Create Action**, then the **Collect leads** card ("Collect leads by capturing user details"), then **Start customizing**. ![The Collect leads dialog with a sample chat that shows a lead form, and Start customizing.](annotated/01-card--open.webp "The Collect leads dialog.") **3. Configure General** **When to use:** when the agent should collect a lead. You can also add other instructions, such as *Show only the form without listing its fields*. The **Preview** beside the editor helps you spot what to change. ![When to use filled in: collect a lead when the customer asks for a bulk order quote.](annotated/03-when.webp "Describe when to collect a lead.") To run the Action only as a [Procedure](/docs/user-guides/chatbot/procedures/procedures-overview) step, turn on [**Only use in Procedures**](/docs/user-guides/chatbot/actions/actions-overview#only-use-in-procedures). **When to use** is then hidden. Click **Continue**. ![The General section with the pointer on Continue.](annotated/04-continue.webp "Continue saves General.") **4. Define your fields** In **Fields**, choose how the agent collects details and which fields it asks for. See [Fields](#fields). **5. Write your messages** With **Collect from a form**, write the **Success Message** and **Dismiss Message**. See [Messages](#messages). **6. Set your destinations** In **Destinations**, choose where leads are sent, or click **Skip**. See [Destinations](#destinations). **7. Choose Channels** Collect leads works on every channel except phone. Turn it on or off for each configured channel. See [Channels](/docs/user-guides/chatbot/actions/actions-overview#channels). **8. Enable and test** Click **Enable**, then try the Action in the **Preview**: the **Live** tab is a test chat, and **Form**, **Submitted** and **Dismissed** show each state of the form. ## Fields In **Fields**, you first choose how the agent collects the lead's details. This applies to the Chat bubble and Help page; other channels, like WhatsApp and Instagram, always collect details conversationally. | Mode | What it does | | - | - | | **Collect from a form** | Visitors fill out fields in a widget. Up to three fields: **Name**, **Email** and **Phone**. | | **Collect conversationally** | The agent gathers the details in the conversation. Supports custom fields. | ![The Fields section with How should details be collected? set to Collect from a form, and the Name, Email and Phone fields, each with a switch, Label, Placeholder and Required.](annotated/04-continue--open.webp "Fields: what the lead form asks for.") > [!NOTE] > > In either mode, **Email** or **Phone** must be on and required, so every lead can be contacted. Otherwise the section shows "Make email or phone required so the lead can be contacted". ### Form mode Turn each of the three fields on or off with its switch. Each field has a **Label** and a **Placeholder** you can change, and a **Required** box. ![Form mode with the Name and Email fields turned on, each with a Label and Placeholder, and Email marked Required.](annotated/05-fields.webp "Turn on the fields the form shows; make Email required.") ### Conversational mode The fields table has two parts: * **Identity fields:** Name, Email and Phone. Turn each on or off and mark it required. Their types are fixed, and you can add a description to guide how the agent asks for it. * **Custom fields:** extra details the agent collects in chat before saving the lead, such as company name or order size. Click **Add data input**, then set a **Name**, a **Type** (Text, Number, Boolean, Date or Email), a **Description** and **Required**. Untick **Required** to save the lead without that field. The agent asks for every required field before saving the lead. Optional fields are saved when the customer gives them. #### Example: a conversational lead **Name** and **Email** on, with **Email** required, plus a custom text field `company` described as "The company the visitor works for". | Who | Message | | - | - | | **Visitor** | Can your team send a quote for 200 branded mugs? | | **Agent** | Happy to help. What's the best email to send the quote to? | | **Visitor** | sam@example.com. I'm Sam from Harbour Cafes. | | **Agent** | Thanks, Sam. I've passed your details to our sales team, and they'll email your quote. | The lead is saved with the name, email and company, and appears under **Activity › Leads**. ### UTM hidden fields Turn on **UTM hidden fields** at the bottom of **Fields** to save which campaign brought each lead. It works in both modes, and visitors never see an extra field. ![The bottom of Fields with the UTM hidden fields switch and its description.](annotated/06-utm.webp "UTM hidden fields saves the visitor's campaign.") QwryAI saves the visitor's `utm_source`, `utm_medium`, `utm_campaign`, `utm_term` and `utm_content` with each lead and sends them in the `leads.submit` webhook. Pass them as user metadata when you identify the visitor; see [UTM tracking](/docs/developer-guides/website-integration/utm-tracking). UTMs the visitor doesn't have are left out. ### Messages The **Messages** section appears only with **Collect from a form**. Both messages are required. **Success Message:** shown when the lead is collected. **Dismiss Message:** shown when the visitor dismisses the form. ![The Messages section with a Success Message about the sales team emailing a quote and a Dismiss Message.](annotated/08-messages.webp "Write the Success and Dismiss messages.") ## Destinations Use **Destinations** to choose where leads are sent. Click **Skip** if you don't want to send them anywhere. ![The Destinations section with Webhooks, a Create webhook button, and Email notification with its switch.](annotated/09-messages-continue--open.webp "Destinations: where leads go.") ### Webhooks Add one or more endpoints that receive each lead. **1. Open Destinations** Expand the **Destinations** section of the Action. **2. Enter the endpoint URL** Type the URL, for example `https://mywebsite.com/webhooks`. It must start with `https://`. **3. Create the webhook** Click **Create webhook**. ### Email notification Turn on **Email notification** to get an email every time a lead is collected through this Action. Add up to 10 recipients. > [!NOTE] > > This email is sent for each lead as it's collected. For one summary a day instead, turn on **Receive email with daily leads** in the agent's notification [settings](/docs/user-guides/chatbot/settings). ## Where leads are saved Every lead is saved under **Activity › Leads** with its conversation, then sent to your webhooks and email recipients. > [!TIP] > > Test the Action with a conversation that should trigger it, and check that the lead appears under **Activity › Leads** with every field filled in. ## Channels Collect leads works on every channel except phone. Use **Channels** to turn it on or off for each one. ![The Channels section with Configured channels and their switches.](annotated/10-skip--open.webp "Channels for Collect leads.") ## Best practices > [card] Pick the right mode | /docs/user-guides/chatbot/actions/collect-leads | Use a form for a quick capture in the Chat bubble, and conversational mode for custom fields or a softer ask. > [card] Ask at the right moment | /docs/user-guides/chatbot/actions/actions-overview | Collect the lead once the visitor shows intent, not at the start of every conversation. > [card] Use plain language | /docs/user-guides/chatbot/playground | Keep When to use short, with examples, and say what to do rather than what to avoid. > [card] Keep required fields few | /docs/user-guides/chatbot/actions/collect-data | Require the contact method and little else. ## Frequently asked questions > [accordion] Can I have more than one Collect leads Action on an agent? > > No. Each agent has one. To collect other sets of details, add [Collect data](/docs/user-guides/chatbot/actions/collect-data) Actions, as many as your plan's Action limit allows. > [accordion] Does the lead form work on WhatsApp and email? > > The form shows only in the Chat bubble and Help page. On WhatsApp, email and other channels, the agent asks for the same fields in the conversation. > [accordion] Will the agent show the form again after a visitor dismisses it? > > It can. Dismissing the form shows your **Dismiss Message**. Whether the agent offers the form again depends on **When to use**, so say if it shouldn't ask again in the same conversation. > [accordion] Can a custom field be a dropdown? > > No. Custom fields can be Text, Number, Boolean, Date or Email. To steer answers, list the options in the field's description, for example "One of: Starter, Growth, Enterprise." > [accordion] Where do I see my leads? > > Under **Activity › Leads** in the sidebar. Leads are also sent to your webhooks and email recipients. ## Next steps > [card] Collect data | /docs/user-guides/chatbot/actions/collect-data | Collect any details you choose. > [card] UTM tracking | /docs/developer-guides/website-integration/utm-tracking | Pass campaign details with each visitor. > [card] Webhooks | /docs/developer-guides/webhooks | Receive leads in your own systems. > [card] Procedures | /docs/user-guides/chatbot/procedures/procedures-overview | Collect a lead as a step in a flow. > [card] Actions overview | /docs/user-guides/chatbot/actions/actions-overview | See every Action you can add.