Design Workflows Builder Toolbox Enterprise Automation

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: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

  3. 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

  4. Save your changes.

  5. Create a new integration step to get contact details.

  6. 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.

  7. 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:

    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",
                "propertyName": "PROPERTY_NAME",
                "operator": "EQ"
              }
            ]
          }
        ]
      }
      
  2. 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.

  3. 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": {
          "hs_pipeline": "PIPELINE_ID",
          "hs_pipeline_stage": "PIPELINE_STAGE_ID",
          "hs_ticket_priority": "TICKET_PRIORITY",
          "subject": "TICKET_SUBJECT"
        }
      }
      
  3. Create a variable for the ticketID with the value of: $.id.

  4. Save your changes.

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

  6. 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": {
          "hs_pipeline": "PIPELINE_ID",
          "hs_pipeline_stage": "PIPELINE_STAGE_ID",
          "hs_ticket_priority": "TICKET_PRIORITY",
          "hubspot_owner_id": "OWNER_ID",
          "subject": "{Instance name}"
        }
      }
      
  7. Save your changes.