LoopFour

HubSpot

CRM integration for contacts, companies, deals, and marketing automation

HubSpot

Connect to HubSpot for CRM automation including contacts, companies, deals, tickets, and engagement activities.

Overview

HubSpot is an all-in-one CRM platform. The integration supports:

  • Contacts - Individual contact records
  • Companies - Organization records
  • Deals - Sales pipeline and deals
  • Tickets - Customer support tickets
  • Associations - Relationships between objects
  • Engagements - Notes, tasks, and activities
  • Custom Objects - Any CRM object type

Prerequisites

  • HubSpot account (Free, Starter, Professional, or Enterprise)
  • Private app with required scopes
  • API access enabled

Authentication

HubSpot uses OAuth 2.0 for authentication via Nango.

curl "http://localhost:3000/api/v1/connections/hubspot/auth-url" \
  -H "x-api-key: YOUR_API_KEY"

Required Scopes

ScopeDescription
crm.objects.contacts.read/writeContact access
crm.objects.companies.read/writeCompany access
crm.objects.deals.read/writeDeal access
crm.objects.owners.readOwner access

Available Actions

Contact Actions

getContact

Get a contact by ID.

{
  "action": "hubspot.getContact",
  "config": {
    "contactId": "12345",
    "properties": ["email", "firstname", "lastname", "phone", "company"]
  }
}

createContact

Create a new contact.

{
  "id": "create-contact",
  "type": "action",
  "action": "hubspot.createContact",
  "config": {
    "email": "{{input.email}}",
    "firstName": "{{input.firstName}}",
    "lastName": "{{input.lastName}}",
    "phone": "{{input.phone}}",
    "company": "{{input.companyName}}",
    "website": "{{input.website}}",
    "jobTitle": "{{input.title}}",
    "lifecycleStage": "lead",
    "leadStatus": "NEW",
    "address": "{{input.address.street}}",
    "city": "{{input.address.city}}",
    "state": "{{input.address.state}}",
    "zip": "{{input.address.zip}}",
    "country": "{{input.address.country}}",
    "customProperties": {
      "source_workflow": "{{workflowId}}"
    }
  }
}

Parameters:

FieldTypeRequiredDescription
emailstringNoEmail address
firstNamestringNoFirst name
lastNamestringNoLast name
phonestringNoPhone number
companystringNoCompany name
websitestringNoWebsite URL
jobTitlestringNoJob title
lifecycleStagestringNoLifecycle stage
leadStatusstringNoLead status
customPropertiesobjectNoCustom property values

updateContact

Update an existing contact.

{
  "action": "hubspot.updateContact",
  "config": {
    "contactId": "{{input.contactId}}",
    "lifecycleStage": "customer",
    "customProperties": {
      "last_workflow_run": "{{now}}"
    }
  }
}

deleteContact

Delete a contact.

{
  "action": "hubspot.deleteContact",
  "config": {
    "contactId": "{{input.contactId}}"
  }
}

searchContacts

Search contacts with filters.

{
  "action": "hubspot.searchContacts",
  "config": {
    "filterGroups": [
      {
        "filters": [
          {
            "propertyName": "lifecyclestage",
            "operator": "EQ",
            "value": "lead"
          },
          {
            "propertyName": "createdate",
            "operator": "GTE",
            "value": "{{input.startDate}}"
          }
        ]
      }
    ],
    "sorts": [
      { "propertyName": "createdate", "direction": "DESCENDING" }
    ],
    "properties": ["email", "firstname", "lastname", "company"],
    "limit": 100,
    "after": "{{steps.previous.output.paging.next.after}}"
  }
}

Company Actions

getCompany

Get a company by ID.

{
  "action": "hubspot.getCompany",
  "config": {
    "companyId": "12345",
    "properties": ["name", "domain", "industry", "numberofemployees"]
  }
}

createCompany

Create a new company.

{
  "id": "create-company",
  "type": "action",
  "action": "hubspot.createCompany",
  "config": {
    "name": "{{input.companyName}}",
    "domain": "{{input.domain}}",
    "description": "{{input.description}}",
    "industry": "{{input.industry}}",
    "phone": "{{input.phone}}",
    "website": "{{input.website}}",
    "numberOfEmployees": "{{input.employees}}",
    "annualRevenue": "{{input.revenue}}",
    "lifecycleStage": "lead",
    "type": "{{input.companyType}}"
  }
}

updateCompany / deleteCompany

{
  "action": "hubspot.updateCompany",
  "config": {
    "companyId": "{{input.companyId}}",
    "industry": "Technology",
    "lifecycleStage": "customer"
  }
}

searchCompanies

{
  "action": "hubspot.searchCompanies",
  "config": {
    "filterGroups": [
      {
        "filters": [
          {
            "propertyName": "industry",
            "operator": "EQ",
            "value": "TECHNOLOGY"
          }
        ]
      }
    ],
    "properties": ["name", "domain", "industry"],
    "limit": 50
  }
}

Deal Actions

getDeal

Get a deal by ID.

{
  "action": "hubspot.getDeal",
  "config": {
    "dealId": "12345",
    "properties": ["dealname", "dealstage", "amount", "closedate"]
  }
}

createDeal

Create a new deal.

{
  "id": "create-deal",
  "type": "action",
  "action": "hubspot.createDeal",
  "config": {
    "dealName": "{{input.dealName}}",
    "dealStage": "appointmentscheduled",
    "pipeline": "default",
    "amount": "{{input.dealValue}}",
    "closeDate": "{{input.expectedCloseDate}}",
    "dealType": "newbusiness",
    "description": "{{input.notes}}",
    "priority": "high",
    "associations": [
      {
        "to": { "id": "{{input.contactId}}" },
        "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 3 }]
      }
    ]
  }
}

Parameters:

FieldTypeRequiredDescription
dealNamestringYesDeal name
dealStagestringYesPipeline stage ID
pipelinestringNoPipeline ID (default: default)
amountnumberNoDeal value
closeDatestringNoExpected close date
dealTypestringNoDeal type
descriptionstringNoDescription
prioritystringNoPriority level
associationsarrayNoAssociated records

updateDeal / deleteDeal

{
  "action": "hubspot.updateDeal",
  "config": {
    "dealId": "{{input.dealId}}",
    "dealStage": "closedwon",
    "amount": "{{input.finalAmount}}"
  }
}

searchDeals

{
  "action": "hubspot.searchDeals",
  "config": {
    "filterGroups": [
      {
        "filters": [
          {
            "propertyName": "dealstage",
            "operator": "IN",
            "values": ["presentationscheduled", "decisionmakerboughtin"]
          }
        ]
      }
    ],
    "properties": ["dealname", "amount", "closedate"],
    "limit": 50
  }
}

Ticket Actions

getTicket

Get a ticket by ID.

{
  "action": "hubspot.getTicket",
  "config": {
    "ticketId": "12345",
    "properties": ["subject", "content", "hs_pipeline_stage"]
  }
}

createTicket

Create a support ticket.

{
  "id": "create-ticket",
  "type": "action",
  "action": "hubspot.createTicket",
  "config": {
    "subject": "{{input.subject}}",
    "content": "{{input.description}}",
    "pipeline": "default",
    "pipelineStage": "1",
    "priority": "HIGH",
    "category": "{{input.category}}",
    "associations": [
      {
        "to": { "id": "{{input.contactId}}" },
        "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 16 }]
      }
    ]
  }
}

updateTicket / deleteTicket

{
  "action": "hubspot.updateTicket",
  "config": {
    "ticketId": "{{input.ticketId}}",
    "pipelineStage": "4"
  }
}

Association Actions

createAssociation

Create a relationship between objects.

{
  "action": "hubspot.createAssociation",
  "config": {
    "fromObjectType": "contacts",
    "fromObjectId": "{{input.contactId}}",
    "toObjectType": "companies",
    "toObjectId": "{{input.companyId}}",
    "associationType": "contact_to_company"
  }
}

getAssociations

Get associations for an object.

{
  "action": "hubspot.getAssociations",
  "config": {
    "objectType": "contacts",
    "objectId": "{{input.contactId}}",
    "toObjectType": "deals"
  }
}

deleteAssociation

{
  "action": "hubspot.deleteAssociation",
  "config": {
    "fromObjectType": "contacts",
    "fromObjectId": "{{input.contactId}}",
    "toObjectType": "companies",
    "toObjectId": "{{input.companyId}}",
    "associationType": "contact_to_company"
  }
}

Engagement Actions

createNote

Create a note on a record.

{
  "action": "hubspot.createNote",
  "config": {
    "body": "{{input.noteContent}}",
    "ownerId": "{{input.ownerId}}",
    "associations": [
      {
        "to": { "id": "{{input.contactId}}" },
        "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 202 }]
      }
    ]
  }
}

createTask

Create a task.

{
  "action": "hubspot.createTask",
  "config": {
    "subject": "Follow up call",
    "body": "{{input.taskDescription}}",
    "status": "NOT_STARTED",
    "priority": "HIGH",
    "taskType": "CALL",
    "ownerId": "{{input.ownerId}}",
    "reminderDate": "{{input.dueDate}}",
    "associations": [
      {
        "to": { "id": "{{input.contactId}}" },
        "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 204 }]
      }
    ]
  }
}

updateTask

{
  "action": "hubspot.updateTask",
  "config": {
    "taskId": "{{input.taskId}}",
    "status": "COMPLETED"
  }
}

Owner Actions

getOwner

Get owner details.

{
  "action": "hubspot.getOwner",
  "config": {
    "ownerId": "12345"
  }
}

listOwners

List all owners.

{
  "action": "hubspot.listOwners",
  "config": {
    "email": "{{input.email}}",
    "limit": 100
  }
}

Generic Object Actions

Work with any HubSpot CRM object.

getObject / createObject / updateObject / deleteObject

{
  "action": "hubspot.getObject",
  "config": {
    "objectType": "products",
    "objectId": "12345",
    "properties": ["name", "price"]
  }
}

searchObjects

{
  "action": "hubspot.searchObjects",
  "config": {
    "objectType": "products",
    "filterGroups": [
      {
        "filters": [
          { "propertyName": "price", "operator": "GTE", "value": "100" }
        ]
      }
    ],
    "properties": ["name", "price", "description"],
    "limit": 50
  }
}

Search Operators

OperatorDescription
EQEqual to
NEQNot equal to
LTLess than
LTELess than or equal
GTGreater than
GTEGreater than or equal
BETWEENBetween two values
INIn list of values
NOT_INNot in list
HAS_PROPERTYProperty exists
NOT_HAS_PROPERTYProperty doesn't exist
CONTAINS_TOKENContains text

Webhook Triggers

HubSpot webhooks trigger workflows on CRM changes.

{
  "trigger": {
    "type": "webhook",
    "provider": "hubspot",
    "events": ["contact.creation", "deal.propertyChange"]
  }
}

Event Types:

  • contact.creation, contact.deletion, contact.propertyChange
  • company.creation, company.deletion, company.propertyChange
  • deal.creation, deal.deletion, deal.propertyChange

Example Workflow

Lead to deal workflow:

{
  "name": "Convert Lead to Deal",
  "trigger": {
    "type": "webhook",
    "provider": "hubspot",
    "events": ["contact.propertyChange"]
  },
  "steps": [
    {
      "id": "check-lifecycle",
      "type": "condition",
      "config": {
        "conditions": {
          "left": "{{input[0].propertyName}}",
          "operator": "eq",
          "right": "lifecyclestage"
        },
        "then": ["check-stage"],
        "else": []
      }
    },
    {
      "id": "check-stage",
      "type": "condition",
      "config": {
        "conditions": {
          "left": "{{input[0].propertyValue}}",
          "operator": "eq",
          "right": "salesqualifiedlead"
        },
        "then": ["get-contact"],
        "else": []
      }
    },
    {
      "id": "get-contact",
      "type": "action",
      "action": "hubspot.getContact",
      "config": {
        "contactId": "{{input[0].objectId}}",
        "properties": ["email", "firstname", "lastname", "company"]
      }
    },
    {
      "id": "create-deal",
      "type": "action",
      "action": "hubspot.createDeal",
      "config": {
        "dealName": "{{steps.get-contact.output.properties.company}} - New Opportunity",
        "dealStage": "appointmentscheduled",
        "associations": [
          {
            "to": { "id": "{{input[0].objectId}}" },
            "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 3 }]
          }
        ]
      }
    },
    {
      "id": "create-task",
      "type": "action",
      "action": "hubspot.createTask",
      "config": {
        "subject": "Initial discovery call with {{steps.get-contact.output.properties.firstname}}",
        "status": "NOT_STARTED",
        "priority": "HIGH",
        "associations": [
          {
            "to": { "id": "{{steps.create-deal.output.id}}" },
            "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 216 }]
          }
        ]
      }
    }
  ]
}

Rate Limits

LimitValue
API calls per day250,000 (Professional)
API calls per second150
Batch operations100 records per batch
Search results10,000 max

Troubleshooting

Common Errors

ErrorCauseSolution
PROPERTY_DOESNT_EXISTInvalid property nameCheck property API name
CONFLICTDuplicate recordUse search to find existing
RATE_LIMITToo many requestsImplement backoff
OBJECT_NOT_FOUNDInvalid object IDVerify ID exists