HubSpot + Zapier | Solving Custom Object Integration Challenges

  • 18 October 2023
  • 1 reply
  • 815 views

Historical Challenges:

Working with HubSpot Custom Objects and Zapier has posed unique challenges that differ from the seamless integration experienced with standard HubSpot objects. This distinction has been a recurring source of frustration for developers and data integrators alike.

Custom Objects in HubSpot have historically presented hurdles when it comes to integration. Unlike their standard counterparts, they require a more specialized approach. Developers often encountered limitations in bridging the gap between Standard Objects and Custom Objects, making data synchronization a complex task

A Solution Emerges:
By harnessing the capabilities of the HubSpot CRM Custom Object API in tandem with Zapier Webhooks, it has become easier than ever to navigate these hurdles.

 

Sample Solution: Creating HubSpot Custom Object Associations with Zapier Webhooks

Goal: 

Automatically associate a Contact with a “Metro Area” Custom Object using Zip Code. While this example uses the Contact Object, it can be applied to any HubSpot Standard Object as well.

Prerequisites:

The Custom Object must have a Property with a Unique Value in order to search by the alternative ID in the query parameter. In this example, the “Metro Area” Custom Object uses Zip Code as its unique ID, which we’ll use to match with Contact’s Zip Code.

Required Data:

  1. You will need to find the “objectId” of your Custom Object. You can find this in HubSpot > Settings > Objects > Custom Objects -- select the object you’re working with. The objectId will be in the URL of the page you’re viewing. 
    1. 'https://app.hubspot.com/sales-products-settings/your_account_id/object/2-19643068
      Your objectId will be different than above, but we’ll use this for examples below.
       
  2. You will need to create a HubSpot Private App with the needed ScopesYou can find this in HubSpot > Settings > Integrations > Private Apps. 
    1. This will be needed in every Webhook step below - {{private_app_key}}

 

Step-by-Step Workflow:

  1. Trigger: In this example, a Contact-based Active List in HubSpot is used as the Zap Trigger. We will also retrieve the Zip Code property value in this step. 
    1. Contact Zip Code token will be used below in Step 3
       
  2. Filter Validation: A Filter step is introduced to ensure the validity of the Contact Property selected. This step is also used to avoid unnecessary Zap Task Usage. 
     
  3. Custom Object Lookup: The process uses a GET Webhook to search for the matching Custom Object. It identifies the Custom Object by using the Contact’s Zip Code from Step 1 in the query parameter to match the records. 
    1. GET in Webhooks by Zapier - Find Custom Object

      1. URL: https://api.hubapi.com/crm/v3/objects/2-19643068/{{id_token_previous_step_1}}

      2.  

        Query String Params

        archived: false
        this is not a variable

        idProperty: zip_code
        this is the internal name of property to search (to match value of this property above in the URL {{id_token_previous_step_1}}

      3. Headers

        Authorization: Bearer {{private_app_key}}

    2. RESULT = Property Values for the Custom Object, most importantly the {{hs_object_id}} that will be required in Step 5

  4. Association Labels Retrieval: Another GET Webhook is utilized to retrieve the Association Labels for the Custom Object. These association Category and IDs are essential for the final step of creating associations.
    1. GET in Webhooks by Zapier - Read Association Labels

      1. ​​​​​​​URL: https://api.hubapi.com/crm/v4/associations/2-19643068/contact/labels

        Headers

        Authorization: Bearer {{private_app_key}}

    2. RESULT = Property Values for the Association Category and Type, that will be required in Step 5
       
  5. Create Associations: Finally, a PUT Webhook is employed to establish the association between the Contact and the Custom Object. This step completes the integration, ensuring that the two entities are linked within HubSpot.
    1. PUT in Webhooks by Zapier - Create Association
      ​​​​​​​URL: https://api.hubapi.com/crm/v4/objects/contact/{{hs_object_id_token_previous_step_1}}/associations/default/2-19643068/{{ id_token_previous_step_3 }}​​​​​
    2. Payload Type = json

    3. Data

      associationCategory : {{Category from Step 4 above}}

      associationTypeId: {{Results Type Id from Step 4 above}}

      Headers

      Authorization: Bearer {{private_app_key}}

      content-type: application/json


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Is there a way to trigger zaps when a HubSpot Custom object has a property updated (or any other kind of Custom Object Update) without using a HS Webhook