Integrate with HubSpot

Send data to and get them from HubSpot straight into your workflow.

Before you begin

  • Get a HubSport API key. To do that, you need to create a private app and set permissions for this app based on the data you want to get from HubSpot. For details, see HubSpot documentation. Make sure your app has the following CRM scope: crm.objects.deals.read

Get deal and contract details from HubSpot

  1. In Next Matter select the workflow that should integrate with HubSpot, and add a new integration step to get deal details.
  2. Click Settings and enter the following details:
  • Method: POST
  • URL: https://api.hubapi.com/crm/v3/objects/deals/DEAL_ID?associations=contacts

Tip: Get a HubSpot Deal ID. You can find the ID of a deal on the deal record itself under the property Deal ID.

  • Headers: Content-Type: application/json
  • Headers: Authorization: Bearer HUBSPOT_API_KEY
  1. Create a variable for the deal name with the value of: $.properties.dealname and for the contact association ID with the value of $.associations.contacts.results[0].id
  2. Save your changes.
  3. Create a new integration step to get contact details.
  4. Click Settings and enter the following details:
    • Method: POST
    • URL: https://api.hubapi.com/crm/v3/objects/contacts/{2. Get Deal - Integration step - contact_association_id (plain)}
      The {VALUE} is a data reference to the Next Matter variable.
    • Headers: Content-Type: application/json
    • Headers: Authorization: Bearer HUBSPOT_API_KEY
    • Create a variable for the contact ID with the value of: $.id and for the contact email with the value of $.properties.email, and for the contact's first name with the value of $.properties.firstname.
  5. Save your changes.

Search for a contact/deal in HubSpot

In Next Matter select the workflow that should integrate with HubSpot, and add a new integration step.

  1. Click Settings and enter the following details:
  • Method: POST
  • URL: https://api.hubapi.com/crm/v3/objects/contacts/search

πŸ“˜

You can also have a step that searches HubSport for a deal by property. In this case, make a call to https://api.hubapi.com/crm/v3/objects/deals/search

  • Headers: Content-Type: application/json
  • Headers: Authorization: Bearer HUBSPOT_API_KEY
  • Body:
    {
      "filterGroups": [
        {
          "filters": [
            {
              "value": "PROPERTY_VALUE", //Replace the placeholders
              "propertyName": "PROPERTY_NAME",
              "operator": "EQ"//This can be EQ, NEQ, BETWEEN.
            }
          ]//There are more filter options than the ones shown here. For details, check Hubspot documentation or reach out to us. 
        }
      ]
    }
    
  1. Create a variable for the contact ID with the value of $.results[0].id.

πŸ“˜

If you search for a deal, create a variable for deal ID with the value of $.results[0].id.

  1. Save your changes.

Create and update a HubSpot ticket

  1. In Next Matter, select the process that should integrate with HubSpot, and add a new integration step to get deal details.
  2. Click Settings and enter the following details:
  • Method: POST
  • URL: https://api.hubapi.com/crm/v3/objects/tickets
  • Headers: Content-Type: application/json
  • Headers: Authorization: Bearer HUBSPOT_API_KEY
  • Body:
    {"properties":{//replace the placeholders
      "hs_pipeline": PIPELINE_ID,//you can find it in HubSpot by going to Data Management > Objects > Tickets and opening the Pipelines tab. 
      "hs_pipeline_stage":  PIPELINE_STAGE_ID,//navigate to HubSpot > Settings > Sales > Deals. There you can check for each pipeline and their stage IDs.
      "hs_ticket_priority": "TICKET_PRIORITY",
      "subject": "TICKET_SUBJECT"
    }}
    
  1. Create a variable for the ticketID with the value of: $.id.

  2. Save your changes.

  3. To push the ticket to the next stage, create a new integration step.

  4. Click Settings and enter the following details:

    • Method: PATCH
    • URL: https://api.hubapi.com/crm/v3/objects/tickets/{2.Create Ticket - Integration Step - TicketID(plain)}?hapikey=KEY
      The {VALUE} is a data reference to the Next Matter variable.
      Make sure to replace the KEY variable with your HubSpot API key.
    • Headers: Content-Type: application/json
    • Headers: Authorization: Bearer HUBSPOT_API_KEY
    • Body:
      {"properties":{//replace all the placeholders
        "hs_pipeline": PIPELINE_ID,
        "hs_pipeline_stage":  PIPELINE_STAGE_ID,
        "hs_ticket_priority": "TICKET_PRIORITY",
        "hubspot_owner_id": "OWNER_ID",
        "subject": "{Instance name}//replace this with a data reference from Nexct Matter
      "
      }}
      
Find HubSpot owner ID
  1. Click the Settings cog in the main menu in HubSpot.
  2. In the left-hand menu, click Properties.
  3. Under Contact properties, type Owner in the search bar.
  4. Hover over Contact owner and click View.
  5. At the bottom of the next page, your HubSpot Owner IDs are listed in the Dropdown options table in the Internal Value column.
  1. Save your changes.