> ## Documentation Index
> Fetch the complete documentation index at: https://watermelon.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Process leads via Zapier

> When leads come into your Agent, you can forward them to your CRM system via Zapier.

<Info>
  Process leads via Zapier is available on the following plans: Advanced, Business and Enterprise.
</Info>

You can set up an automation to forward leads to your CRM. This helps you to follow up leads and get more commercial value from your Agent. To make this happen, we need to tell the Agent when to forward the lead, which data it needs to collect and we need to build an automation to make sure the data is forwarded. To do so you need to do 3 things:

1. Set up Handover in Watermelon
2. Write instruction in Watermelon
3. Create automation in Zapier.

<Info>
  For this automation, you need a paid Zapier account
</Info>

<Note>
  How does handover work?

  Agent collects details → customer types trigger → Human Handover fires → CRM Action runs.
</Note>

## 1. Set up Handover

Start by setting up Human Handover in Watermelon. The Handover is needed so the Agent knows in which cases the Agent needs to forward leads. The handover triggers the automation in Zapier which forwards the leads to your CRM.

<Steps>
  <Step title="Open Human Handover in Watermelon">
    Open your Agent and go to Human Handover.

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/handover-menu.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=b47d0bd7e455654fc0a75dd38a3dd614" alt="Handover Menu" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/handover-menu.png" />
    </Frame>
  </Step>

  <Step title="Choose when Human Handover can happen (inside/outside office hours)">
    Decide if you want to forward leads outside office hours. We recommend to switch the toggle so leads outside business hours will also be forwarded to your CRM.

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/handover-outside-business-hours.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=713e9892ed594ba56ed96887dd33f1ec" alt="Handover Outside Business Hours" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/handover-outside-business-hours.png" />
    </Frame>
  </Step>

  <Step title="Add instructions">
    To manage expectations for the end-user, you can add instructions for the Agent what it needs to say during/outside office hours. Example:

    > Your request has been submitted. Our team will reach out as soon as possible.

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/handover-instructions.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=2cec128149c994435d0da133a2f9d865" alt="Handover Instructions" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/handover-instructions.png" />
    </Frame>

    <Warning>
      Be aware that after the handover your Agent has left the Chat. You can include this information in the instructions above.
    </Warning>
  </Step>

  <Step title="Create Trigger">
    To technically trigger the handover, we need a code word. We call this code word a trigger. When a customer types this trigger, the message is automatically forwarded.

    Click **Create** to create a new Trigger and select **new** in the dropdown menu.

    Suggested trigger: **Submit request.**

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/handover-trigger.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=a4bc01059db7294b1edeef42a1a9c259" alt="Handover Trigger" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/handover-trigger.png" />
    </Frame>

    <Note>
      It's important to choose a trigger sentence which is not used in conversations often. Otherwise the automation might be triggered without all necessary data.
    </Note>
  </Step>
</Steps>

## 2. Write instruction

You'll now write an instruction where you explain when a customer needs to write **Submit request**.

<Steps>
  <Step title="Create new Instruction">
    In the Agent settings, go to **Instructions** and click **Create** to create a new instruction.
  </Step>

  <Step title="Write instruction">
    Write an instruction where you explain the following to the Agent:

    1. In which case does the Agent forward the lead.
    2. Add a list of all items the Agent needs to collect before the handover.
    3. Lastly add the handover trigger. This trigger should be the same combination of words you used in the set up of the Handover above.

       \
       Example:

    > When someone asks for a offer, you ask the following details from the customer:
    >
    > 1. Name
    > 2. Email address
    > 3. Phone number
    >
    >    When you received this information, you ask the person to write **Submit request**. This way, an employee can reach out.

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/instruction-handover.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=8a5bee3e375936d8ba6393bccf04bc4b" alt="Instruction Handover" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/instruction-handover.png" />
    </Frame>
  </Step>
</Steps>

## 3. Create automation

Now everything is set up in Watermelon, we can create the automation in Zapier. This automation will make sure your chats will actually be forwarded to your CRM System.

<Steps>
  <Step title="Open Zapier in Apps">
    In Watermelon, go to **Integrations** and open **Zapier**.

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/zapier-integrations.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=82a944ee8514a8b18ca50ac9519d8a0e" alt="Zapier Integrations" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/zapier-integrations.png" />
    </Frame>
  </Step>

  <Step title="Select App and workflow">
    In the next screen, select **Create from scratch** at the bottom of the page.

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/zapier-create-from-scratch.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=d20ba25d3c3485a40b0d812509cb59d5" alt="Zapier Create From Scratch" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/zapier-create-from-scratch.png" />
    </Frame>
  </Step>

  <Step title="Connect Watermelon to Zapier">
    Zapier will open in a new screen. It should show as the image below. Click **Select** to connect Watermelon to Zapier.

    <Frame>
      <img src="https://mintcdn.com/watermelon/m0SdOc4sit8TtPGk/images/automation-guides/forward-conversations-to-email/forward-conversations-email-connect.png?fit=max&auto=format&n=m0SdOc4sit8TtPGk&q=85&s=7246cdb7b8215e7d2914bb61c4bf20d3" alt="Forward Conversations Email Connect Pn" width="2888" height="1376" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-connect.png" />
    </Frame>
  </Step>

  <Step title="Add API Keys">
    A new screen will open where you need to add API keys.

    <Frame>
      <img src="https://mintcdn.com/watermelon/cm_xIakt0l-qRUnh/images/automation-guides/forward-conversations-to-email/forward-conversations-email-zapier-api-keys.png?fit=max&auto=format&n=cm_xIakt0l-qRUnh&q=85&s=1c572ce481aab90a07c99138026a42fb" alt="Forward Conversations Email Zapier Api Keys Pn" width="2878" height="1580" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-zapier-api-keys.png" />
    </Frame>
  </Step>

  <Step title="Create API Key">
    In Watermelon, go to API keys and click **Create** to create a new API key.

    Give the API Key a name and make sure to select **Read and write**. Add the keys to the Zapier fields.

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/zapier-api-key.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=d56ffb734d3bfd08afc85e9ddf7abb83" alt="Zapier Api Key" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/zapier-api-key.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/watermelon/SSTykc9V_kfCQUMw/images/guides/automation-guides/process-leads-via-zapier/zapier-create-api-key.png?fit=max&auto=format&n=SSTykc9V_kfCQUMw&q=85&s=1a8426514b91a4032851e6c7754a4d0f" alt="Zapier Create Api Key" width="2938" height="1390" data-path="images/guides/automation-guides/process-leads-via-zapier/zapier-create-api-key.png" />
    </Frame>
  </Step>

  <Step title="Test connection">
    In Zapier, click on continue to test the connection with Watermelon.

    <Frame>
      <img src="https://mintcdn.com/watermelon/7pXm_JLplF3HXQry/images/automation-guides/forward-conversations-to-email/forward-conversations-email-api-key-test-connection.png?fit=max&auto=format&n=7pXm_JLplF3HXQry&q=85&s=1e24d00985750dcb3571b9c08d4933fd" alt="Forward Conversations Email Api Key Test Connection Pn" width="2900" height="1376" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-api-key-test-connection.png" />
    </Frame>

    <Warning>
      You need a conversation in your inbox to test this step. Follow these steps if no conversations are handed off:

      1. Open your Chat Widget
      2. Start a conversation
      3. Use the Trigger word you set up in step 1 of this article.
      4. After the conversation is handed off in Watermelon, click **Find new records** in Zapier.

         Your new conversation should show up.
    </Warning>
  </Step>

  <Step title="Add AI by Zapier">
    Click on the plus button to add an extra step and select **AI by Zapier**.

    <Frame>
      <img src="https://mintcdn.com/watermelon/zofLCnI651Jn5MrV/images/automation-guides/forward-conversations-to-email/forward-conversations-email-extra-step.png?fit=max&auto=format&n=zofLCnI651Jn5MrV&q=85&s=3d99ffaf1a384513b81e010aa2fa3cab" alt="Forward Conversations Email Extra Step Pn" width="2928" height="1420" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-extra-step.png" />
    </Frame>
  </Step>

  <Step title="Set up AI by Zapier">
    1. In the **input field**, click on the Plus button and select **Message payload**.

    <Frame>
      <img src="https://mintcdn.com/watermelon/zofLCnI651Jn5MrV/images/automation-guides/forward-conversations-to-email/forward-conversations-email-input-field.png?fit=max&auto=format&n=zofLCnI651Jn5MrV&q=85&s=660d1a70e18e1a52ed6bb672b7f3fd0c" alt="Forward Conversations Email Input Field Pn" width="2926" height="1414" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-input-field.png" />
    </Frame>

    2. Add the following prompt:

       > Get the details from the Message payload

           <Frame>
             <img src="https://mintcdn.com/watermelon/kRl4V26COK4HR4O3/images/automation-guides/forward-conversations-to-email/forward-conversations-email-prompt.png?fit=max&auto=format&n=kRl4V26COK4HR4O3&q=85&s=556a1d904696ff5baf8b9c3164076594" alt="Forward Conversations Email Prompt Pn" width="2922" height="1406" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-prompt.png" />
           </Frame>
    3. At **Output fields**, click **add field**. Give the fields a name and select the field type. Repeat this for all desired data.

           <Frame>
             <img src="https://mintcdn.com/watermelon/kRl4V26COK4HR4O3/images/automation-guides/forward-conversations-to-email/forward-conversations-email-output-field.png?fit=max&auto=format&n=kRl4V26COK4HR4O3&q=85&s=bc0609958b23132a61d8c752292288e1" alt="Forward Conversations Email Output Field Pn" width="2924" height="1414" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-output-field.png" />
           </Frame>
    4. Click **Generate preview** to see the outcome of your prompt and click **Finish.**

           <Frame>
             <img src="https://mintcdn.com/watermelon/kRl4V26COK4HR4O3/images/automation-guides/forward-conversations-to-email/forward-conversations-email-preview.png?fit=max&auto=format&n=kRl4V26COK4HR4O3&q=85&s=25143479b53f54f85dac94cb1c8a235c" alt="Forward Conversations Email Preview Pn" width="2926" height="1420" data-path="images/automation-guides/forward-conversations-to-email/forward-conversations-email-preview.png" />
           </Frame>
  </Step>

  <Step title="Set up CRM connection">
    Select your CRM, in this example we'll use Hubspot. \
    At **Action event,** you can select the action you'd like e.g. **Create Deal** or **Create contact**.

    In account, select your CRM and follow the steps to connect your CRM.

    <Frame>
      <img src="https://mintcdn.com/watermelon/KwMJOnK-OxHuvEQh/images/guides/automation-guides/forward-leads/forward-leads-zapier-account.png?fit=max&auto=format&n=KwMJOnK-OxHuvEQh&q=85&s=25f2759fe760a574b685d4c45177031d" alt="Forward Leads Zapier Account" width="2922" height="1374" data-path="images/guides/automation-guides/forward-leads/forward-leads-zapier-account.png" />
    </Frame>
  </Step>

  <Step title="Configure CRM">
    Now you are going to configure your CRM settings.

    1. **Name**: Provide a name for the new deals. With the + button, you can add details from the message payload such as Name of customer.

           <Frame>
             <img src="https://mintcdn.com/watermelon/KwMJOnK-OxHuvEQh/images/guides/automation-guides/forward-leads/forward-leads-zapier-deal-configuration.png?fit=max&auto=format&n=KwMJOnK-OxHuvEQh&q=85&s=4ee3dcd552b2f7e3df00c2311f264c99" alt="Forward Leads Zapier Deal Configuration" width="2922" height="1374" data-path="images/guides/automation-guides/forward-leads/forward-leads-zapier-deal-configuration.png" />
           </Frame>
    2. **Deal** **Pipeline**: Select the Deal pipeline where the lead has to go in your CRM.
    3. **Deal** **Stage**: Select the stage where the lead should end up.
    4. Fill in other fields, you need for your lead. Optionally, you can add an extra step where you create a note in the deal where you add the Message Payload. This way, you'll have the complete chat conversation in your deal.
  </Step>

  <Step title="Test step">
    Click on **Continue** and test the step.
  </Step>

  <Step title="Publish workflow">
    When the data is received correctly, you can **Publish** your workflow by clicking **Publish**.
  </Step>
</Steps>

Your automation is now completed. You can test your automation in the Chat Widget. The handover functionality and automation do not work in the **Playground**.
