Skip to main content

Hubspot Component

Manage objects and associations in the Hubspot CRM platform

Component key: hubspot

Description

Hubspot is a Customer Relationship Management software for inbound marketing, sales, and customer service. This component allows you to interact with the Hubspot REST API.

Documentation for Hubspot's REST API used in this component can be found at https://developers.hubspot.com/docs/api/overview.

tip

If a Hubspot API endpoint doesn't have a corresponding action within this component, you can leverage the Raw Request action to make a request to any Hubspot API endpoint.

Connections

Hubspot OAuth 2.0

The Hubspot component authenticates requests through a OAuth 2.0 credential. Information on how to generate an OAuth 2.0 credential with Hubspot can be found here Now, you will have to configure a new Auth 2.0 Hubspot connection in Prismatic.

  • For Client ID and Client Secret enter the values that you got from the Hubspot auth settings.
  • For Scopes choose from the list found on the Hubspot docs

Private App Access Token

Triggers

HubSpot Webhook

Trigger for handling webhooks from HubSpot | key: webhook

Output Example Payload

{
"payload": {
"headers": {
"Accept": "*/*",
"Content-Type": "application/json",
"Host": "hooks.prismatic.io",
"User-Agent": "HubSpot Connect 2.0 (http://dev.hubspot.com/) (namespace: webhooks-nio-http-client) - WebhooksExecutorDaemon-executor",
"X-Amz-Cf-Id": "szJqgg_sc_8OJond4p35bY5yRruCefV1LemK3SBeBqgqA2779Bf0Eg==",
"X-Amzn-Trace-Id": "Root=1-648a56ba-5143e5ce5c2bf3c1307a842e",
"X-HubSpot-Request-Timestamp": "1686787770380",
"X-HubSpot-Signature": "43bb817ae58839a72680655fc39e23a901be4cadb95f3d0c55818476ac227efc",
"X-HubSpot-Signature-v3": "AwM+3h1whh6JQ1O1oUoY/AENKbO3klURU+R7mX3WGKs=",
"X-HubSpot-Signature-Version": "v1",
"X-HubSpot-Timeout-Millis": "10000",
"X-Trace": ""
},
"queryParameters": null,
"rawBody": {
"data": "<data (547 bytes)>"
},
"body": {
"data": [
{
"eventId": 3895062059,
"subscriptionId": 2139616,
"portalId": 39830612,
"appId": 1793923,
"occurredAt": 1686787769982,
"subscriptionType": "contact.propertyChange",
"attemptNumber": 0,
"objectId": 1301,
"propertyName": "firstname",
"propertyValue": "John1",
"changeSource": "INTEGRATION",
"sourceId": "1793923"
},
{
"eventId": 1020354057,
"subscriptionId": 2139618,
"portalId": 39830612,
"appId": 1793923,
"occurredAt": 1686787769982,
"subscriptionType": "contact.creation",
"attemptNumber": 0,
"objectId": 1301,
"changeFlag": "CREATED",
"changeSource": "INTEGRATION",
"sourceId": "1793923"
}
],
"contentType": "application/json"
},
"pathFragment": "",
"webhookUrls": {
"Flow 1": "https://hooks.example.prismatic.io/trigger/EXAMPLESW5zdGFuY2VGbG93Q29uZmlnOjJjNjkwY2VjLWMwODctNDMxZC05MjVjLTEzODQ2OTkzNzAyMw=="
},
"webhookApiKeys": {
"Flow 1": ["sample-api-key"],
"create contact": ["sample-api-key"],
"HubSpot trigger": ["sample-api-key"]
},
"invokeUrl": "https://hooks.example.prismatic.io/trigger/EXAMPLESW5zdGFuY2VGbG93Q29uZmlnOjJjNjkwY2VjLWMwODctNDMxZC05MjVjLTEzODQ2OTkzNzAyMw==",
"executionId": "SW5zdGFuY2VFeGVjdXRpb25SZXN1bHQ6NTgwMzdhOTAtMWZkZi00NjFiLTgwOTUtNWY4Njg1YzUxMzY3",
"customer": {
"id": "testCustomerId",
"name": "Test Customer",
"externalId": "testCustomerExternalId"
},
"instance": {
"id": "testInstanceId",
"name": "Test Instance"
},
"user": {
"id": "testUserId",
"email": "testUserEmail@example.com",
"name": "Test User",
"externalId": "testUserExternalId"
}
}
}

Data Sources

Object Selection

A list of Hubspot objects | key: getObjectSelection | type: objectSelection


Actions

Archive Association

Remove the associations between two provided objects | key: ArchiveAssociations


Create Association

Create an association between the objects identified in the step | key: createAssociations


Create Company

Create a new company | key: createCompany


Create Contact

Create a new contact | key: CreateContact


Create Custom Object

Creates new custom object schema | key: createCustomObject

Output Example Payload

{
"data": {
"id": "123456",
"createdAt": "2020-02-20T18:07:11.390Z",
"updatedAt": "2020-02-20T18:09:07.555Z",
"properties": [
{
"updatedAt": "2020-02-20T18:07:11.802Z",
"createdAt": "2020-02-20T18:07:11.802Z",
"name": "my_object_property",
"label": "My object property",
"type": "string",
"fieldType": "text",
"groupName": "my_object_information",
"displayOrder": -1,
"calculated": false,
"externalOptions": false,
"archived": false,
"hasUniqueValue": false
}
],
"associations": [
{
"id": "123",
"fromObjectTypeId": "2-123456",
"toObjectTypeId": "0-1",
"name": "my_object_to_contact"
}
],
"labels": {
"singular": "My object",
"plural": "My objects"
},
"requiredProperties": [
"my_object_property"
],
"searchableProperties": [
"my_object_property"
],
"primaryDisplayProperty": "my_object_property",
"metaType": "PORTAL_SPECIFIC",
"fullyQualifiedName": "p7878787_my_object\"",
"name": "my_object"
}
}

Create Deal

Create a new deal | key: createDeal


Create Line Item

Create a new line item | key: createLineItem


Create Product

Create a new product | key: createProduct


Create Webhook

Create a webhook in HubSpot | key: createWebhook


Delete all Instanced Webhooks

Delete all webhooks created by this instance in HubSpot | key: deleteAllWebhooks


Delete Company

Delete an existing company by Id | key: deleteCompany


Delete Contact

Retrieve a list of all contacts | key: deleteContact


Delete Custom Object

Removes custom object schema | key: deleteCustomObject

Output Example Payload

{
"data": {
"id": "123456",
"createdAt": "2020-02-20T18:07:11.390Z",
"updatedAt": "2020-02-20T18:09:07.555Z",
"properties": [
{
"updatedAt": "2020-02-20T18:07:11.802Z",
"createdAt": "2020-02-20T18:07:11.802Z",
"name": "my_object_property",
"label": "My object property",
"type": "string",
"fieldType": "text",
"groupName": "my_object_information",
"displayOrder": -1,
"calculated": false,
"externalOptions": false,
"archived": false,
"hasUniqueValue": false
}
],
"associations": [
{
"id": "123",
"fromObjectTypeId": "2-123456",
"toObjectTypeId": "0-1",
"name": "my_object_to_contact"
}
],
"labels": {
"singular": "My object",
"plural": "My objects"
},
"requiredProperties": [
"my_object_property"
],
"searchableProperties": [
"my_object_property"
],
"primaryDisplayProperty": "my_object_property",
"metaType": "PORTAL_SPECIFIC",
"fullyQualifiedName": "p7878787_my_object\"",
"name": "my_object"
}
}

Delete Deal

Delete a deal by its Id | key: deleteDeal


Delete Line Item

Delete an existing line item by Id | key: deleteLineItem


Delete Product

Delete a product by Id | key: deleteProduct


Delete Webhook

Delete a webhook by ID in HubSpot | key: deleteWebhook


Get Company

Retrieve the information or metadata of a company by Id, domain, or name | key: getCompany


Get Contact

Get the information and metadata of a contact by Id or Email | key: getContact


Get Current User

Return information about the current session's user. | key: getCurrentUser


Get Custom Object

Retrieves a specific custom object | key: getCustomObject

Output Example Payload

{
"data": {
"id": "123456",
"createdAt": "2020-02-20T18:07:11.390Z",
"updatedAt": "2020-02-20T18:09:07.555Z",
"properties": [
{
"updatedAt": "2020-02-20T18:07:11.802Z",
"createdAt": "2020-02-20T18:07:11.802Z",
"name": "my_object_property",
"label": "My object property",
"type": "string",
"fieldType": "text",
"groupName": "my_object_information",
"displayOrder": -1,
"calculated": false,
"externalOptions": false,
"archived": false,
"hasUniqueValue": false
}
],
"associations": [
{
"id": "123",
"fromObjectTypeId": "2-123456",
"toObjectTypeId": "0-1",
"name": "my_object_to_contact"
}
],
"labels": {
"singular": "My object",
"plural": "My objects"
},
"requiredProperties": [
"my_object_property"
],
"searchableProperties": [
"my_object_property"
],
"primaryDisplayProperty": "my_object_property",
"metaType": "PORTAL_SPECIFIC",
"fullyQualifiedName": "p7878787_my_object\"",
"name": "my_object"
}
}

Get Deal

Retrieve information and metadata about a deal by its Id or name | key: getDealById


Get Line Item

Retrieve the information and metadata of a line item by Id | key: getLineItem


Get Product

Retrieve the information and metadata of a product by Id or name | key: getProduct


List Association Types

Retrieve a list of all association types available between two objects | key: listAssociationTypes


List Companies

Retrieve a list of all companies | key: listCompanies

Output Example Payload

{
"data": {
"results": [
{
"id": 12345,
"properties": {
"createdate": "2021-09-14T@@:36:404Z",
"domain": null,
"hs_lastmodifieddate": "2021-09-14T@@:36:404Z",
"hs_object_id": 12345,
"name": "Example Company"
},
"pipeline": "default",
"createdAt": "2021-09-14T@@:36:404Z",
"updatedAt": "2021-09-14T@@:36:404Z",
"archived": false
}
],
"paging": {
"next": {
"after": "123456789",
"link": "https://api.hubapi.com/crm/v3/objects/products?limit=1&after=123456789"
}
}
}
}

List Contacts

Retrieve a list of all contacts | key: listContacts

Output Example Payload

{
"data": {
"results": [
{
"id": 12345,
"properties": {
"createdate": "2021-09-14T@@:36:404Z",
"email": "someone@example.com",
"firstname": "John",
"hs_lastmodifieddate": "2021-09-14T@@:36:404Z",
"lastname": "Doe",
"hs_object_id": 12345
},
"pipeline": "default",
"createdAt": "2021-09-14T@@:36:404Z",
"updatedAt": "2021-09-14T@@:36:404Z",
"archived": false
}
],
"paging": {
"next": {
"after": "123456789",
"link": "https://api.hubapi.com/crm/v3/objects/products?limit=1&after=123456789"
}
}
}
}

List Custom Objects

Retrieve all custom objects | key: listCustomObjects

Output Example Payload

{
"data": {
"results": [
{
"id": "123456",
"createdAt": "2020-02-20T18:07:11.390Z",
"updatedAt": "2020-02-20T18:09:07.555Z",
"properties": [
{
"updatedAt": "2020-02-20T18:07:11.802Z",
"createdAt": "2020-02-20T18:07:11.802Z",
"name": "my_object_property",
"label": "My object property",
"type": "string",
"fieldType": "text",
"groupName": "my_object_information",
"displayOrder": -1,
"calculated": false,
"externalOptions": false,
"archived": false,
"hasUniqueValue": false
}
],
"associations": [
{
"id": "123",
"fromObjectTypeId": "2-123456",
"toObjectTypeId": "0-1",
"name": "my_object_to_contact"
}
],
"labels": {
"singular": "My object",
"plural": "My objects"
},
"requiredProperties": [
"my_object_property"
],
"searchableProperties": [
"my_object_property"
],
"primaryDisplayProperty": "my_object_property",
"metaType": "PORTAL_SPECIFIC",
"fullyQualifiedName": "p7878787_my_object\"",
"name": "my_object"
}
]
}
}

List Deals

Retrieve a list of all deals | key: listDeals

Output Example Payload

{
"data": {
"results": [
{
"id": 12345,
"properties": {
"amount": "600.00",
"closedate": "2021-09-14T@@:36:404Z",
"createdate": "2021-09-14T@@:36:404Z",
"dealname": "My Example Deal",
"dealstage": "presentationscheduled",
"hs_lastmodifieddate": "2021-09-14T@@:36:404Z",
"hs_object_id": 12345
},
"pipeline": "default",
"createdAt": "2021-09-14T@@:36:404Z",
"updatedAt": "2021-09-14T@@:36:404Z",
"archived": false
}
],
"paging": {
"next": {
"after": "123456789",
"link": "https://api.hubapi.com/crm/v3/objects/products?limit=1&after=123456789"
}
}
}
}

List Line Items

Retrieve a list of all line items | key: listLineItems

Output Example Payload

{
"data": {
"results": [
{
"id": 12345,
"properties": {
"amount": "600.00",
"createdate": "2021-09-14T@@:36:404Z",
"hs_lastmodifieddate": "2021-09-14T@@:36:404Z",
"hs_object_id": 12345,
"hs_product_id": 12345,
"quantity": null
}
}
],
"paging": {
"next": {
"after": "123456789",
"link": "https://api.hubapi.com/crm/v3/objects/products?limit=1&after=123456789"
}
}
}
}

List Products

Retrieve a list of all products | key: listProducts

Output Example Payload

{
"data": {
"results": [
{
"id": 12345,
"properties": {
"createdate": "2021-09-14T@@:36:404Z",
"hs_lastmodifieddate": "2021-09-14T@@:36:404Z",
"hs_object_id": 12345,
"name": "Example Product",
"price": "6000.00"
}
}
],
"paging": {
"next": {
"after": "123456789",
"link": "https://api.hubapi.com/crm/v3/objects/products?limit=1&after=123456789"
}
}
}
}

List Properties

Retrieve a list of all configured object properties. | key: listProperties


List Webhooks

List all webhooks for a server | key: listWebhooks


Raw Request

Send a raw HTTP request to Hubspot API | key: rawRequest

This action allows you to make requests to any Hubspot API endpoint. This is especially helpful for search endpoints, where objects may have custom properties that are unique to your customers.

The data that you send to Hubspot can be dynamically generated in a code step. Then, you can pass the code step's results as an input reference to the Data input. For example, if you are using Hubspot's search API to search for Hubspot "deals" that have the name "Sample Deal" and are valued less than 100 dollars, you can create a code step that reads like this:

module.exports = async ({ logger, configVars }, stepResults) => {
const data = {
filterGroups: [
{
filters: [
{
propertyName: "dealname",
operator: "EQ",
value: "Sample Deal",
},
{
propertyName: "amount",
operator: "LT",
value: "100",
},
],
},
],
properties: [
"hs_object_id",
"createdate",
"hubspot_owner_id",
"dealstage",
"amount",
"dealname",
"closedate",
"days_to_close",
"hs_analytics_source",
"hs_analytics_source_data_1",
"hs_analytics_source_data_2",
"hs_campaign",
"hs_closed_amount",
"hs_lastmodifieddate",
"dealtype",
"description",
],
};

return { data };
};

On the raw request step, enter /crm/v3/objects/deals/search as the URL input, POST as the Method, and reference the code step's results as the Data input.


Read Association

Get the Ids of the objects associated with those specified in the step | key: readAssociations


Search Deals

Returns a list of deals that match the given properties | key: searchDeals


Update Company

Update the information and metadata of an existing company | key: updateCompany


Update Contact

Update the information and metadata of an existing contact | key: updateContact


Update Custom Object

Updates an object's schema | key: updateCustomObject

Output Example Payload

{
"data": {
"id": "123456",
"createdAt": "2020-02-20T18:07:11.390Z",
"updatedAt": "2020-02-20T18:09:07.555Z",
"properties": [
{
"updatedAt": "2020-02-20T18:07:11.802Z",
"createdAt": "2020-02-20T18:07:11.802Z",
"name": "my_object_property",
"label": "My object property",
"type": "string",
"fieldType": "text",
"groupName": "my_object_information",
"displayOrder": -1,
"calculated": false,
"externalOptions": false,
"archived": false,
"hasUniqueValue": false
}
],
"associations": [
{
"id": "123",
"fromObjectTypeId": "2-123456",
"toObjectTypeId": "0-1",
"name": "my_object_to_contact"
}
],
"labels": {
"singular": "My object",
"plural": "My objects"
},
"requiredProperties": [
"my_object_property"
],
"searchableProperties": [
"my_object_property"
],
"primaryDisplayProperty": "my_object_property",
"metaType": "PORTAL_SPECIFIC",
"fullyQualifiedName": "p7878787_my_object\"",
"name": "my_object"
}
}

Update Deal

Update the information or metadata of an existing deal | key: updateDeal


Update Line Item

Update an the information and metadata of an existing line item | key: updateLineItem


Update Product

Update the information and metadata of an existing product | key: updateProduct


Validate Connection

Returns a boolean value that specifies whether the provided Connection is valid | key: validateConnection