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

# Lead Capture in HubSpot Using AI Agent

Use the **Lead Capture** dialog template to collect lead details conversationally and automatically create lead objects in HubSpot CRM.

## Overview

The process involves three steps:

1. [Link your HubSpot account](#step-1-link-your-hubspot-account)
2. [Install the Lead Capture template](#step-2-install-the-lead-capture-template-for-hubspot-crm)
3. [Train and test the dialog task](#step-3-train-and-test-the-dialog-task)

***

## Step 1: Link Your HubSpot Account

1. Go to **Marketplace** in the left navigation and select **HubSpot** integration.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/marketplace_hubspot.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=0d047028139e4d5f60ff185fbcd47f8c" alt="Marketplace HubSpot" width="1917" height="811" data-path="ai-for-service/automation/how-tos/hubspot/images/marketplace_hubspot.png" />

2. Click **Install** at the top right. The **Instructions** tab opens.

3. Click the **Authenticate and Install** tab.

4. Under **Authorization Type**, select **Pre-authorize the Integration** and then **OAuth**.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/authorization.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=d7654b0146e778b5c923fe1910c1c8fc" alt="Authorization" width="1050" height="730" data-path="ai-for-service/automation/how-tos/hubspot/images/authorization.png" />

**System Authorization**

Use Kore.ai's preconfigured HubSpot app:

1. Select **System** and click **Authorize**. You are redirected to the HubSpot login page.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/system_authorization.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=4341c4bee62ae8924fda571c15e8cf54" alt="System Authorization" width="1051" height="730" data-path="ai-for-service/automation/how-tos/hubspot/images/system_authorization.png" />

2. Enter your developer account credentials to connect your HubSpot account.

**Custom Authorization**

Create your own OAuth profile:

1. Select **Custom**, then click **Select Authorization** > **Create New**.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/custom_authorization.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=baa47410fbec867ec98ae190c9f1bf3a" alt="Custom Authorization" width="1059" height="742" data-path="ai-for-service/automation/how-tos/hubspot/images/custom_authorization.png" />

2. Select **OAuth v2**. See [Setting Up Authorization Using OAuth v2](/ai-for-service/app-settings/dev-tools/bot-authorization/setting-up-authorization-using-oauth-v2).

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/Oauth.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=d177e648afda2a0289a832c811a9a7dd" alt="OAuth" width="1186" height="911" data-path="ai-for-service/automation/how-tos/hubspot/images/Oauth.png" />

3. Enter the following credentials:

   | Field                  | Description                     |
   | ---------------------- | ------------------------------- |
   | Callback URL           | Your app's callback URL.        |
   | Identity Provider Name | Name for the provider.          |
   | Client ID              | OAuth client ID.                |
   | Client Secret Key      | OAuth client secret.            |
   | Authorization URL      | HubSpot authorization endpoint. |
   | Token Request URL      | Token endpoint.                 |
   | Scope                  | Required OAuth scopes.          |
   | Refresh Token URL      | Token refresh endpoint.         |

4. Click **Save Auth**, select the new profile, and click **Authorize**. You are redirected to `app.hubspot.com`.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/hubspot_authorization.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=95153bb57143cd00a6725a3778a53916" alt="HubSpot Authorization" width="1048" height="753" data-path="ai-for-service/automation/how-tos/hubspot/images/hubspot_authorization.png" />

5. Enter your login credentials. After successful authorization, click **Proceed**. The **Integration Installed Successfully** confirmation is displayed.

***

## Step 2: Install the Lead Capture Template for HubSpot CRM

1. Go to **Marketplace** and select the **Lead Capture for HubSpot CRM** dialog template.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/marketplace_Leadcapture.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=80adb6d1d4764d287c378e18ac0b4be5" alt="Marketplace Lead Capture" width="1915" height="648" data-path="ai-for-service/automation/how-tos/hubspot/images/marketplace_Leadcapture.png" />

2. Click **Install**.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/install_leadcapture.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=828cfac4287153e4273559f84321f0dd" alt="Install Lead Capture" width="1075" height="760" data-path="ai-for-service/automation/how-tos/hubspot/images/install_leadcapture.png" />

3. Fill in the dialog task details:

   | Field               | Description                         |
   | ------------------- | ----------------------------------- |
   | Name                | Name of the dialog.                 |
   | Description         | Description of the dialog.          |
   | Utterances          | Phrases that trigger this dialog.   |
   | Channel Experiences | Channel-specific behavior settings. |
   | Lead Capture Setup  | Fields and information to capture.  |

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/install_template.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=bf83fd1d98d86256a7d2767744337509" alt="Install Template" width="1474" height="847" data-path="ai-for-service/automation/how-tos/hubspot/images/install_template.png" />

4. Click **Finish**. The dialog task is auto-created and listed under **Automation AI** > **Use Cases** > **Dialogs**.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/dialog-task.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=df94b4fd42883c8a0f299d3e8c688526" alt="Dialog Task" width="1888" height="544" data-path="ai-for-service/automation/how-tos/hubspot/images/dialog-task.png" />

***

## Step 3: Train and Test the Dialog Task

1. Click the **Test** icon.

2. Select a conversation type (Voice or Chat).

3. Click **Train** to process untrained utterances.

4. Follow the prompts in the App console to create a lead.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/appconsole.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=d1a14c1e205af2a37c1ebbd669e867f1" alt="App Console" width="489" height="769" data-path="ai-for-service/automation/how-tos/hubspot/images/appconsole.png" />

5. Enter lead details when prompted.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/lead_details.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=e7dfd6f123b92017938965a0de342740" alt="Lead Details" width="496" height="808" data-path="ai-for-service/automation/how-tos/hubspot/images/lead_details.png" />

6. The lead is created in HubSpot. To view it, log in to HubSpot, then go to **CRM** > **Contacts**.

   <img src="https://mintcdn.com/koreai/WO96SKE0qtZRC8Dw/ai-for-service/automation/how-tos/hubspot/images/Hubspot.png?fit=max&auto=format&n=WO96SKE0qtZRC8Dw&q=85&s=61e8890b1b5681bbfa2383f38c8e39f7" alt="HubSpot Contacts" width="1873" height="511" data-path="ai-for-service/automation/how-tos/hubspot/images/Hubspot.png" />

7. [Publish your app](/ai-for-service/deployment/publishing-app#publishing-an-agent) to make this capability available to end users.
