# Connect your AI agent to Zapier > Send the leads your AI agent collects to thousands of apps, or ask your agent questions from any Zap The QwryAI app for Zapier connects your agent to the apps your team already uses. Send each lead your agent collects to a spreadsheet, CRM or inbox, or ask your agent a question from a Zap and use its reply in the next step. ## Before you start * A QwryAI workspace on a plan that includes API access. * A Zapier account. * For lead Zaps, an agent with a [Collect leads](/docs/user-guides/chatbot/actions/collect-leads) Action. ## QwryAI triggers and actions in Zapier | In Zapier | Type | What it does | | - | - | - | | **Form Submission** | Trigger | Starts a Zap each time a customer submits a **Collect leads** Action, in a lead form or during the conversation | | **Send Prompt** | Action | Sends a message to your agent and returns its reply | ### Form Submission trigger Choose the **Agent** whose leads you want. Every **Collect leads** Action on that agent sends to the Zap, including Actions you add later. Each lead gives you these fields to map: | Field | Value | | - | - | | **Conversation ID** | The conversation the lead came from | | **Customer Email** | The email the customer gave | | **Customer Name** | The name the customer gave | | **Customer Phone** | The phone number the customer gave | | Custom fields | Each other field a conversational **Collect leads** Action asks for, by its name | ![Create Action: selecting the Collect leads card opens its dialog with a sample lead form and Start customizing.](walkthroughs/zapier-collect-leads.gif) ### Send Prompt action | Field | Value | | - | - | | **Message** | Required. What to ask the agent | | **Agent** | Required. The agent that answers | | **Model** | Optional. Overrides the model chosen in the agent's settings. Each model shows the credits a reply uses. | | **Conversation ID** | Optional. Continues an earlier conversation. Leave it empty for a one-off question. | The step returns the agent's reply as **Text**. ## What you can automate * **Leads to a spreadsheet:** add a row to Google Sheets for every lead. * **Leads to your CRM:** create a contact in your CRM with the customer's name, email and phone. * **Team alerts:** post a message in a team channel when a new lead arrives. * **Drafted answers:** when a support email or form arrives, send it to your agent with **Send Prompt** and use the reply as a draft. ## How to connect Zapier **1. Create an API key** In QwryAI, open your workspace **Settings › API keys** and select **Create API key**. Keep every permission on, select **Confirm** and copy the key. Zapier uses it to act for your workspace. ![The API keys page under Workspace settings, with the Manage keys heading and the pointer on Create API key.](annotated/02-api-keys.webp "Settings › API keys › Create API key.") ![The Create New API Key dialog with a switch for each permission, above Cancel and Confirm.](annotated/02-api-keys--open.webp "Keep every permission on, then select Confirm.") **2. Open the QwryAI app in Zapier** Open your agent's **Channels** page and select **Setup** on the **Zapier** card. Zapier opens the QwryAI app. Accept the invite if Zapier asks. ![The QwryAI app invite page in Zapier, with the invite accepted and QwryAI available when creating a Zap.](walkthroughs/zapier-invite.gif) ![The Zapier card on the Channels page, Connect your agent with thousands of apps using Zapier., with the pointer on Setup.](annotated/01-channels-card.webp "Channels › Zapier › Setup.") **3. Create a Zap with the QwryAI trigger** In Zapier, select **Create › Zaps**. For the trigger, search for **QwryAI** and choose **Form Submission** as the event. ![In Zapier, a new Zap is created, QwryAI is picked as the trigger app and Form Submission is chosen as the event.](walkthroughs/zapier-trigger.gif) **4. Connect your QwryAI account** Select **Sign in**. In the window that opens, optionally enter a **Display name** to tell your QwryAI accounts apart, paste your key into **API Key** and continue. The connection takes your **Display name**, or your workspace name if you left it empty. ![The QwryAI connection window in Zapier with the Display name and API Key fields; after the key is pasted, the account appears in the Zap labelled with the workspace name.](walkthroughs/zapier-connect.gif) **5. Choose the agent and test** Pick the **Agent** and select **Test trigger**. Zapier shows your agent's latest leads, or a sample lead if there are none yet. ![The Form Submission trigger with an agent chosen in the Agent dropdown; Test trigger returns a lead with Conversation ID, Customer Email, Customer Name and Customer Phone.](walkthroughs/zapier-test.gif) **6. Add the action and publish** Add the step that receives the lead, such as **Google Sheets › Create Spreadsheet Row**, map the QwryAI fields to its columns, test it and select **Publish**. ![A Google Sheets Create Spreadsheet Row action added after the trigger, with Customer Name, Customer Email and Customer Phone mapped to columns, tested and published.](walkthroughs/zapier-action.gif) > [!TIP] > > Submit a test lead in your agent's **Playground**, then check that the Zap ran under **Zap history** in Zapier. To use **Send Prompt**, add a QwryAI action step to any Zap, choose **Send Prompt**, connect the same account, and fill in **Message** and **Agent**. ![A Send Prompt step with a Message mapped from the trigger and an Agent chosen; the test returns the agent's reply as Text.](walkthroughs/zapier-send-prompt.gif) ## Frequently asked questions > [accordion] Which leads reach the Zap? > > Every lead from a **Collect leads** Action on the agent you chose, from the moment the Zap is on. Turning the Zap off stops the deliveries. > [accordion] Do Send Prompt replies use credits? > > Yes. Each reply uses your workspace's message credits, like any other conversation. > [accordion] What happens if I delete the API key? > > Every Zap connected with that key stops. Create a new key and reconnect the account in Zapier. > [accordion] Whose access does the key use? > > Yours. If you leave the workspace or your role loses a permission, the Zaps stop until a member with access connects a new key. > [accordion] Zapier says Account not found > > The API key was deleted or mistyped. Create a new key in QwryAI and reconnect the account in Zapier. > [accordion] I can't create an API key > > Your plan doesn't include API access. Upgrade the workspace, then create the key. > [accordion] No leads arrive in my Zap > > Check that the Zap is on, that the agent has an enabled **Collect leads** Action, and that the lead was submitted to the agent you chose. ## Next steps > [card] Collect leads | /docs/user-guides/chatbot/actions/collect-leads | Choose which details your agent collects, and when. > [card] Webhooks | /docs/developer-guides/webhooks | Send leads and helpdesk events straight to your own endpoint.