/
Add or Update Hubspot Contact

Add or Update Hubspot Contact

The “add or update contact in HubSpot” template can be used to add or update customer data within Hubspot CRM system by passing the email address of that customer. This Public Template uses V3 of the hubspot API.

Input Data

Field

Description

Example

Field

Description

Example

Message Body

This field is the entire JSON payload that is required to be posted to the endpoint.

e.g.

{

  "properties": {

    "email": "learn@alterian.com",

    "firstname": "Al",

    "lastname": "Terian",

    "phone": "07891234567"

  }

}

 

The fields that are needed is entirely down to the HubSpot system

 

 

Provides parameters allowing Hubspot authentication.

Configuration

Field

Description

Example

Field

Description

Example

Hubspot_AuthKey

Hubspot authorisation key for the API

 

Hubspot_URL

The Hubspot API URL for the contacts endpoint to
use e.g.https://api.hubapi.com/crm/v3/objects/contacts

 

Setup and Processing

Prerequisites:

  1. HubSpot Account: Ensure you have an active HubSpot account.

  2. Private App: Create a private app in your HubSpot account to obtain an API token.

Steps to Set Up HubSpot Integration:

  1. Create a Private App in HubSpot:

    • Follow the instructions here to create a private app.

    • This process will provide you with an API token.

  2. Setting Up Parameters:

    • API Token: Store the API token as a global parameter in your Alterian CX system. The parameter should be named hubspot_authkey.

      • Format: The value should be in the format Bearer YOUR_API_TOKEN.

      • Confidentiality: Mark this parameter as confidential.

    • HubSpot URL: Create another global parameter named Hubspot_URL with the value:

      <https://api.hubapi.com/crm/v3/objects/contacts>
  3. Communication Between Rule and HubSpot API:

    • The Hubspot_URL parameter enables communication between the rule and the HubSpot API.

    • When adding a new contact, the HubSpot HTTP response in the rule designer logs should return code 201, indicating successful addition.

    • If a contact already exists (identified by the email address), the response will be 200 for updates, or 409 if there is a conflict, followed by a PATCH call to avoid duplication.

Verifying Integration:

HubSpot defines the email address of a contact as the primary key

  • New Contact Addition: Check the rule designer logs for an HTTP 201 response, confirming that a new contact has been successfully added.

  • Updating Existing Contact:

    • The HTTP response 200 indicates successful updates.

    • A 409 response indicates a conflict due to pre-existing contact, which is then resolved by a PATCH call.

The recommendation for this tile is to partner it up with the Public Template: Build Message.

 

image-20240701-102854.png

This allows the use of the Alterian Message Builder which sits within this public template so {parameters} can be passed into it and resolved from upstream fields to then be sent on to the HubSpot payload as shown below:

 

image-20240701-102924.png

 

HubSpot defines the email address of a contact as the primary key

 

Troubleshooting:

  • No Response: Ensure that the API token is correctly formatted and stored confidentially.

  • Invalid Token: Verify that the token is current and has the required permissions in the HubSpot app settings.

  • Incorrect URL: Double-check the Hubspot_URL parameter value.

 

.

 

Output Data

Field

Description

Example

Field

Description

Example

N/A

 

 

Related content