# CRM Integration: HubSpot

{% hint style="success" %}
Business Goal 1: Synchronize Contact information in HubSpot and IS-Messenger
{% endhint %}

### Synchronize Contact Information in HubSpot and IS-Messenger <a href="#synchronize_contact_information_in_hub_spot_and_respond_io" id="synchronize_contact_information_in_hub_spot_and_respond_io"></a>

**Understanding Contact Syncing Logic**

There are four tasks that can be automated in order to sync contacts.

**Sending data from IS-Messenger to HubSpot**

* [Create or update a contact in HubSpot when a new Contact is added in I](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations/e-commerce-and-crm-integrations/crm-integration-hubspot)[S-Messenger](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations/e-commerce-and-crm-integrations/crm-integration-hubspot)
* [Create or update a contact in HubSpot when a Contact is updated in IS-Messenger](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations/e-commerce-and-crm-integrations/crm-integration-hubspot)

**Sending data from HubSpot to IS-Messenger**

* [Create or update a Contact in IS-Messenger when a new contact is added in HubSpot.](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations/e-commerce-and-crm-integrations/crm-integration-hubspot)
* [Update a Contact's information in IS-Messenger when the Contact is updated in HubSpot.](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations/e-commerce-and-crm-integrations/crm-integration-hubspot)

**Create or update a contact in HubSpot when a new Contact is added in IS-Messenger.**

When a new Contact is added in IS-Messenger, the Zapier template will automatically search for that contact in Hubspot using the email as the identifier. These are the expected outcomes.

| **Trigger Event**                    | **Conditions**                                 | **Actions**                                |
| ------------------------------------ | ---------------------------------------------- | ------------------------------------------ |
| New Contact is added in IS-Messenger | Contact exists in HubSpot                      | Update Contact in HubSpot with new details |
| New Contact is added in IS-Messenger | Contact does not exist in HubSpot              | Create a new HubSpot Contact               |
| New Contact is added in IS-Messenger | Contact does not have an email in IS-Messenger | Zap will stop                              |

### **Method**

* Use a Zapier template

### **Template Configuration**

**IS-Messenger Trigger**

First, follow the steps to set up aIS-Messenger[ Zapier integration here](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations) to configure the trigger.

Run the trigger test and continue on to the action.

**Filter Action**

Filters by Zapier and multi-step Zaps are only available on [Zapier’s Starter plan](https://zapier.com/app/pricing) and above.

This template contains a filter so the Zap will only continue if the IS-Messenger Contact’s email address exists. This is because HubSpot has set email as the required identifier to be used by Zapier.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675157747140/hub-spot-1.png" alt="Zapier filter action"><figcaption></figcaption></figure>

### **HubSpot Action**

Map the fields to be filled in for the newly created Contact. HubSpot has a long list of fields, but email is the only mandatory one. Scroll down and choose any other fields you want to add, e.g., first name, last name, phone number. If you have created [Custom Fields](https://docs.is-messenger.com/ismessenger/workspace-setting) in IS-Messenger that match certain HubSpot fields, consider mapping those as well.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675158455969/create-contact-hub-spot-action-confi.png" alt="HubSpot action configuration"><figcaption></figcaption></figure>

### **Create or update a contact in HubSpot when a Contact is updated in IS-Messenger**

When a Contact is updated in IS-Messenger, the Zapier template will automatically search for that contact in Hubspot using the email as the identifier. These are the expected outcomes.

| **Trigger Event**                  | **Conditions**                                 | **Actions**                                |
| ---------------------------------- | ---------------------------------------------- | ------------------------------------------ |
| Contact is updated in IS-Messenger | Contact exists in HubSpot                      | Update Contact in HubSpot with new details |
| Contact is updated in IS-Messenger | Contact does not exist in HubSpot              | Create a new HubSpot Contact               |
| Contact is updated in IS-Messenger | Contact does not have an email in IS-Messenger | Zap will stop                              |

**Method**

* Use a Zapier template

### **IS-Messenger Trigger**

First, follow the steps to set up a IS-Messenger[ Zapier integration here](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations).

For this trigger, you’ll need to choose which updated fields you want to be included as a trigger. There is the option to select Standard or Custom. For this example, we chose Standard as this would be the best choice for most common use cases. Add all relevant fields by selecting from the dropdown.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675159501231/hub-spot-3.png" alt="Configure respond trigger"><figcaption></figcaption></figure>

### **Filter Action**

Filters by Zapier and multi-step Zaps are only available on [Zapier’s Starter plan](https://zapier.com/app/pricing) and above.

This template contains a filter so the Zap will only continue if theIS-Messenger Contact’s email address exists. This is because HubSpot has set email as the required identifier to be used by Zapier.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675167252498/hub-spot-4.png" alt="Zapier filter action"><figcaption></figcaption></figure>

### **HubSpot Action**

Map the fields to be filled in for the newly created or update Contact. HubSpot has a long list of fields, but the only mandatory field is email. Scroll down and choose any other fields you want to add, e.g., first name, last name, phone number. If you have created [Custom Fields](https://docs.is-messenger.com/ismessenger/workspace-setting) in IS-Messenger that match certain HubSpot fields, consider mapping those as well.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675167773798/hubspot-5.png" alt="Hubspot create or update action"><figcaption></figcaption></figure>

### **Create or update a Contact in** IS-Messenger **when a new contact is added in HubSpot**

When a new contact is added in HubSpot, the Zapier template will automatically search for that contact in IS-Messenger using email as the identifier. These are the expected outcomes.

| **Trigger Event**           | **Conditions**                                  | **Actions**                                     |
| --------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| Contact is added in HubSpot | Contact exists in IS-Messenger with an email    | Update Contact in IS-Messenger with new details |
| Contact is added in HubSpot | Contact does not exist in IS-Messenger          | Create a new IS-Messenger Contact               |
| Contact is added in HubSpot | Contact exists in IS-Messenger without an email | Create a new IS-Messenger Contact\*             |

\*If you recognize this has happened, you can [merge the contacts](https://docs.is-messenger.com/ismessenger/modules/contacts).

**Method**

* Use a Zapier template

### **Template Configuration**

**HubSpot Trigger**

Select your HubSpot account and set up the trigger. For most use cases, simply select Continue. If you have custom fields you want to add, select these from the Additional Properties dropdown.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675170114468/hub-spot-6.png" alt="HubSpot Trigger setup"><figcaption></figcaption></figure>

### **IS-Messenger Action**

{% hint style="warning" %}
First, follow the steps to set up aIS-Messenger[ Zapier integration here](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations).
{% endhint %}

Select email as the Identifier Type. Map the other fields with the information you want from HubSpot, e.g., first name, last name, phone number.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675170575471/hub-spot-7.png" alt="Respond.io Zapier action configuration"><figcaption></figcaption></figure>

### **Update a Contact’s information in IS-Messenger when the Contact is updated in HubSpot**

When a new Contact is added in HubSpot, the Zapier template will automatically search for that contact in IS-Messenger using email as the identifier. These are the expected outcomes.

| **Trigger Event**             | **Conditions**                                  | **Actions**                                     |
| ----------------------------- | ----------------------------------------------- | ----------------------------------------------- |
| Contact is updated in HubSpot | Contact exists in IS-Messenger with an email    | Update Contact in IS-Messenger with new details |
| Contact is updated in HubSpot | Contact does not exist in IS-Messenger          | Create a new IS-Messenger Contact               |
| Contact is updated in HubSpot | Contact exists in IS-Messenger without an email | Create a new IS-Messenger Contact\*             |

\*If you recognize this has happened, you can [merge the contacts](https://docs.is-messenger.com/ismessenger/modules/contacts).

**Method**

Use a Zapier template

### **Template Configuration**

**HubSpot Trigger**

Select your HubSpot account and set up the trigger. For most use cases, simply select Continue. If you have custom fields you want to add, select these from the Additional Properties dropdown.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675173431463/hub-spot-8.png" alt="HubSpot trigger configuration"><figcaption></figcaption></figure>

**IS-Messenger Action**

{% hint style="warning" %}
First, follow the steps to set up a IS-Messenger [ Zapier integration here](https://docs.is-messenger.com/ismessenger/workspace-setting/integrations).
{% endhint %}

Select email as the Identifier Type because HubSpot uses email as the required identifier for Zapier. Map the other fields with the information you want from HubSpot, e.g., first name, last name, phone number.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/ahoczal14z/1675173723590/hub-spot-9.png" alt="Respond.io action configuration"><figcaption></figcaption></figure>

### **Enrich Contact Data using a Workflow**

If you don’t have a Zapier subscription or you only need to get extra details on a particular Contact, use a Workflow. For example, if you’re chatting with someone about a support issue, you can use this Workflow to get additional information about them from HubSpot.

**Method Objectives**

* Provide Contact’s identifier to HubSpot
* Save retrieved data
* Update Contact information on IS-Messenger platform

### **Workflow Setup**

{% hint style="info" %}
**Tip**: Consider using the [Ask for Phone Number or Email method](https://docs.is-messenger.com/ismessenger/support-use-cases/how-to-identify-contacts-by-email-and-phone-numberi) earlier in the Workflow.
{% endhint %}

Here’s how to use an HTTP Request to retrieve one field from an external CRM.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/bnfwwsitqg/1664247850417/0-mai.png" alt="use an HTTP Request to retrieve one field from an external CRM"><figcaption></figcaption></figure>

### **Provide Contact’s Identifier to your CRM**

{% hint style="info" %}
**Tip**: Learn more about [sending HTTP requests here](https://docs.is-messenger.com/ismessenger/modules/workflow).
{% endhint %}

Use the HTTP Request Step to provide the Contact’s identifier to your CRM or business software. In this example, we’ll use Email as the Contact’s identifier. Keep in mind, your CRM may use Email, Phone Number or some other identifier.

<details>

<summary>HubSpot HTTP Request initial configuration</summary>

1\. Add HTTP Request Step and select the request method GET from the dropdown.\
2\. Input the URL endpoint for HubSpot API with your HubSpot API Key (hapikey). Here’s how to get your [HubSpot API Key](https://knowledge.hubspot.com/integrations/how-do-i-get-my-hubspot-api-key).\
3\. Expand Body toggle, select *application/json* as Content-Type Header and leave the Request Body field empty as it’s not required for the *GET* method.\
4\. For the Header toggle, leave the Key and Value field empty as it’s not required by HubSpot.\
\
![](https://files.helpdocs.io/9e3syfbzn8/articles/bnfwwsitqg/1664248202322/1-provide-contacts-email-htt.png)

</details>

### **Save Retrieved Data**

Response Mapping is used to save the information you get from the CRM as a Variable. The Variable can later be used to update the Contact’s field on IS-Messenger. This example will show you how to save the Customer ID field as a Variable.

<details>

<summary>HubSpot Response Mapping configuration</summary>

In order to map the retrieved data, you’ll need to know what the response looks like. For our HubSpot API call example, we can see the [response sample here](https://legacydocs.hubspot.com/docs/methods/contacts/get_contact_by_email). If you want to see what your specific response looks like, use [Postman](https://www.postman.com/).\
\
1\. Pick the fields you want to retrieve. In this example, we’ll retrieve the vid field to get HubSpot Unique Customer ID\
\
![](https://files.helpdocs.io/9e3syfbzn8/articles/bnfwwsitqg/1664248597105/2-response-mapping-2.png)\
2\. In the HTTP Request configuration panel, expand the Response Mapping toggle, add *$.vid* in the JSON Key field and give it a Variable name. Here’s [how to fill JSON Key for different response formats](https://docs.is-messenger.com/ismessenger/modules/workflow).\
\
\
![](https://files.helpdocs.io/9e3syfbzn8/articles/bnfwwsitqg/1664248713668/3-response-mappi.png)<br>

</details>

**Update Contact information on IS-Messenger platform**

{% hint style="info" %}
**Tip**: Learn more about [Update Contact Field Step here](https://docs.is-messenger.com/ismessenger/workspace-setting).
{% endhint %}

Use Update Contact Field Step to automatically update a Contact’s data in IS-Messenger. Here’s an example of how to update one field.

<details>

<summary>Update Contact Field configuration</summary>

1. Add Update Contact Field Step and select the field you want to save from dropdown.
2. Input in the field with the Variable from the Response Mapping section.\
   \
   ![](https://files.helpdocs.io/9e3syfbzn8/articles/bnfwwsitqg/1664249692604/4-update-contact-field.png)

</details>

<br>
