Skip links

How to send leads from your chatbot to HubSpot

Last updated: 02 May 2023 #

This tutorial guides you through the process of integration HubSpot and using this integration to send leads from your chatbot to your CRM.

The principles behind this specific tutorial can be applied to various other HubSpot integration use cases.

Step 1: Find your HubSpot API key #

  1. Log into HubSpot.
  2. Click the cog icon in the top right to reach your Settings.
  3. Using the side-nav, go to Integrations → API Key.

You will find your Active API key in the middle of the page.

To copy it, first click Reveal and pass the Captcha requirements. Then, hit Copy.

Step 2: Integrate HubSpot into the chatbot platform #

In your chatbot platform:

Head to Integrations. Click Add new.

Give your integration a name, for internal purposes.

Find your Base URL #

HubSpot offer a vast API with extensive documentation. Depending on the object you’d like to manipulate, you will need to enter a slightly different Base URL. Typically, you will work with

  • The CRM API
  • The CMS API

Because we are sending leads from the chatbot to HubSpot, we will need the CRM API base URL. It contains objects like contacts, deals, companies, and more.

We’re particularly interested in the Contacts object, for which the base URL is https://api.hubapi.com/crm/v3/objects

Need to work with another part of HubSpot API? Visit their API documentation.

Add the Base URL to your integration and select REST as the API type.

Authorise your integration #

There are four authorisation methods available inside your chatbot platform. For our HubSpot integration, we will use the API Key authorisation.

  1. Pick API Key in the type drop-down.
  2. In the Key field, enter 
    hapikey

    .

  3. In the Value field, paste the API key you grabbed from your HubSpot account earlier.
  4. In the Add to drop-down, select Body.

Hit Save.

Step 3: Create variables #

Now that we have integrated HubSpot, it’s time to think about the value we want to capture from the users.

To generate a lead in HubSpot, at the very least you must capture an email address. We probably want to go a bit further than that and capture:

  • Email address
  • First name
  • Phone number

You are not limited to the three above. You’re free to capture as much information as you need.

In your chatbot platform, go to Settings → Variables.

Click Create. Create three variables, one for each of the above.

> Make sure you follow the required format: 

variable

 or 

variable_name

. No spaces allowed.

Step 4: Create your endpoint #

Endpoints allow you to map the values you capture within your chatbots (e.g. a user’s email address or name) to corresponding fields inside HubSpot. Within this endpoint, we will tell exactly which data we want to send from our chatbot to HubSpot.

Go back to Integrations.

On your newly created HubSpot integration, click Endpoints, then Add new endpoint.

Name your endpoint. Something like ‘Submit a lead to HubSpot’ will do.

Set up the request #

Referring to HubSpot’s API documentation, we know that to create a new contact in our CRM we will need to make a 

POST

 request to the 

/contacts

 folder.

Select 

POST

 in the drop-down and add 

/contacts

 to the folder field.

Create the request body #

You can write the request using either PARAMS or JSON. For this example, we will use JSON.

In the body is where you map the HubSpot properties with the variables we are collecting.

Write the following request:

{ “properties”: { “email”: “{{custom.get.email}}”, “firstname”: “{{custom.get.name}}”, “phone”: “{{custom.get.phone}}” } }

Make sure you enter the variables you’ve created in the 

{{ }}

.

Hit Save.

Step 5: Create your lead generation conversation #

Time to wrap it all up.

Let’s create a short conversation where the chatbot will ask a user for their name, email address, and phone number before sending it all to HubSpot.

Go to Builder.

Create the conversation #

Click Create conversation in the top right. Give your conversation a name, a description, and a trigger of your choice (LEARN MORE ABOUT TRIGGERS).

  1. Create four message steps in this conversation, the first three asking for information from the user, the last one thanking the user and firing the integration.
  2. Between each step, click, drag, and drop a Variable in transition. Pick the variable associated to the step you’re editing (e.g. 
    firstname

     for the step asking the user for their name).

Hit Save.

Add the integration #

At the last step of the conversation, the thank you step, we will fire off the integration.

Open your Block bank. Click, drag, and drop an Integration onto your last step.

Select your integration and endpoint from the dropdowns.

Congratulations, your chatbot is ready to capture leads and send them to HubSpot!

Powered by BetterDocs

Leave a comment

🍪 This website uses cookies to improve your web experience.