Loopfour
Integrations

HubSpot actions

Reference for the HubSpot actions and trigger: the sign-in connection, each action id, the registered events, the fields each action reads and an example.

The HubSpot block reads and writes HubSpot CRM records and starts workflows on HubSpot events. For the plain-language guide, see HubSpot.

When to use it

Use it to read a closed deal, its quote and line items before invoicing, to look up products and owners, and to keep contacts, companies and deals in step with your ledger. Use the trigger to start a workflow when a deal, quote, company or contact changes.

Connection

  • Provider id: hubspot. Sign-in (OAuth) connection.
  • Pin an account with config.connection. Without it, the step uses the company's default HubSpot connection.
  • Inbound events are routed to the connection whose HubSpot portal id matches the event's portalId.

Actions

Action idStudio labelWhat it does
hubspot.getContactGet ContactRead a contact.
hubspot.createContactCreate ContactCreate a contact.
hubspot.updateContactUpdate ContactUpdate a contact.
hubspot.searchContactsSearch ContactsSearch contacts with HubSpot filter groups.
hubspot.getCompanyGet CompanyRead a company.
hubspot.createCompanyCreate CompanyCreate a company.
hubspot.updateCompanyUpdate CompanyUpdate a company.
hubspot.getDealGet DealRead a deal.
hubspot.createDealCreate DealCreate a deal, optionally associated with other records.
hubspot.updateDealUpdate DealUpdate a deal.
hubspot.searchDealsSearch DealsSearch deals with HubSpot filter groups.
hubspot.getQuoteGet QuoteRead a quote, optionally with associations and its discounts, fees and taxes.
hubspot.getQuoteLineItemsGet Quote Line ItemsRead every line item on a quote.
hubspot.searchQuotesSearch Quotes
hubspot.batchReadProductsBatch Read ProductsRead up to 100 HubSpot products by id in one request.
hubspot.getOwnerGet OwnerRead a HubSpot owner (a record's hubspot_owner_id).

Settings

FieldStudio labelTypeUsed byRequired for
connectionHubSpot Accountstring (connection id)AllOptional. Without it the step uses the company default connection for this system
contactIdContact IDstringgetContact, updateContact
companyIdCompany IDstringgetCompany, updateCompany
dealIdDeal IDstringgetDeal, updateDeal
quoteIdQuote IDstringgetQuote, getQuoteLineItems
quotePropertiesProperties (comma-separated)stringgetQuote
lineItemPropertiesLine item properties (comma-separated; replaces the default list)jsongetQuoteLineItems
associationsInclude Associationsstring: false, truegetQuote
quoteAdjustmentsRead quote discounts, fees and taxesstring: false, truegetQuote
quoteFiltersFilters (JSON)jsonsearchQuotes
propertiesProperties (JSON)jsoncreateContact, updateContact, createCompany, updateCompany, createDeal, updateDeal
productIdsProduct IDs (comma-separated or JSON array, max 100)jsonbatchReadProductsbatchReadProducts
productPropertiesProduct properties (JSON array or comma-separated)jsonbatchReadProducts
ownerIdOwner IDstringgetOwnergetOwner
searchQuerySearch QuerystringsearchContacts, searchDeals, searchQuotes
filterGroupsFilter Groups (JSON)jsonsearchContacts, searchDeals, searchQuotes
limitLimitnumbersearchContacts, searchDeals, searchQuotes

Fields each write action reads

The create and update executors build HubSpot properties from named fields. They do not read the Studio Properties (JSON) field (properties), so set these fields in the workflow definition:

ActionFields read
createContact, updateContactemail, firstName, lastName, phone, company, website, jobTitle, lifecycleStage, leadStatus, address, city, state, zip, country, customProperties (object of any other HubSpot property)
createCompany, updateCompanyname, domain, description, industry, phone, address, city, state, zip, country, website, numberOfEmployees, annualRevenue, lifecycleStage, type, customProperties
createDeal, updateDealdealName, dealStage, pipeline (defaults to default on create), amount, closeDate, dealType, description, priority, customProperties; createDeal also takes associations

updateContact, updateCompany and updateDeal also need contactId, companyId or dealId.

Search actions read filterGroups, sorts, properties (array of property names), limit (default 10) and after (paging cursor). searchQuotes also reads quoteFilters. None of them read searchQuery. getContact, getCompany and getDeal read properties as an array of property names.

Output

The step output is the HubSpot response. Records carry id and properties; searches and batchReadProducts return results. For example {{steps.get_deal.properties.amount}}.

Trigger

Trigger config type hubspot_event; the event is stored in eventKind. The handler registers these event names:

GroupEvent names
Contactcontact.creation, contact.deletion, contact.merge, contact.restore, contact.privacyDeletion, contact.propertyChange
Companycompany.creation, company.deletion, company.merge, company.restore, company.propertyChange
Dealdeal.creation, deal.deletion, deal.merge, deal.restore, deal.propertyChange
Ticketticket.creation, ticket.deletion, ticket.merge, ticket.restore, ticket.propertyChange
Conversationconversation.creation, conversation.deletion, conversation.newMessage, conversation.privacyDeletion, conversation.propertyChange
Quotequote.creation, quote.propertyChange

The trigger schema also accepts quote.deletion, * (any event), a <object>.* prefix, and the derived quote.published, which matches a quote.propertyChange on hs_status whose new value is APPROVED, APPROVAL_NOT_NEEDED or PUBLISHED.

Which events are delivered. HubSpot subscriptions are declared in the Loopfour HubSpot app, not registered per connection. The app subscribes to: contact creation, deletion and email changes; company creation and deletion; deal creation, deletion and changes to dealstage and install_completed; quote creation and hs_status changes; ticket creation and deletion; and contact.privacyDeletion, conversation.creation, conversation.deletion, conversation.newMessage and conversation.privacyDeletion. A trigger on any other event name is valid but does not fire.

Matching:

  • eventKind must equal the event name (or match * or a prefix).
  • For a .propertyChange event, an optional propertyName must equal the changed property.
  • An optional filter applies $eq, $ne, $in and similar operators to the event envelope, for example {"data.propertyValue": {"$eq": "closedwon"}}.

At run time the event is the run input under input.webhookEvent. Useful paths: {{input.webhookEvent.eventType}}, {{input.webhookEvent.payload.data.objectId}} (the HubSpot record id), {{input.webhookEvent.payload.data.propertyName}} and {{input.webhookEvent.payload.data.propertyValue}}.

Example

When a deal moves to closed won, read the deal and its owner.

{
  "name": "Closed-won deal to billing",
  "trigger": {
    "type": "hubspot_event",
    "eventKind": "deal.propertyChange",
    "propertyName": "dealstage",
    "filter": { "data.propertyValue": { "$eq": "closedwon" } }
  },
  "steps": [
    {
      "id": "get_deal",
      "type": "action",
      "name": "Read the deal",
      "action": "hubspot.getDeal",
      "config": {
        "dealId": "{{input.webhookEvent.payload.data.objectId}}",
        "properties": ["dealname", "amount", "closedate", "hubspot_owner_id"]
      }
    },
    {
      "id": "get_owner",
      "type": "action",
      "name": "Read the deal owner",
      "action": "hubspot.getOwner",
      "config": { "ownerId": "{{steps.get_deal.properties.hubspot_owner_id}}" }
    }
  ]
}

Live catalog

  • GET /api/v1/blocks/hubspot returns the actions, fields and trigger events.
  • GET /api/v1/blocks/hubspot/actions/<operation>/examples returns stored examples where they exist.

Errors and limits

  • A HubSpot API error fails the step.
  • getQuoteLineItems fails the step when HubSpot returns incomplete associations or pages, rather than returning a partial list.
  • batchReadProducts takes 1 to 100 product ids after de-duplication. getOwner takes an owner id of 1 to 20 digits.

On this page