HubSpot Cloud Mode Integration (Legacy API)

Send events to HubSpot via cloud mode using the legacy API.

RudderStack supports the following API calls while sending data to Hubspot via cloud mode using the legacy API.

warning
Currently, RudderStack does not support the new datetime data type introduced by HubSpot.

Identify

RudderStack sends the identify call to create or update a contact in HubSpot. The contact’s email ID must be present in the traits object of the identify call.

A sample identify call is as shown:

rudderanalytics.identify({
  firstName: "Alex",
  city: "New Orleans",
  country: "USA",
  phone: "+1-202-555-0146",
  email: "alex@example.com",
  custom_flavor: "chocolate",
  custom_date: 1574769933368,
  custom_date1: new Date("2019-10-14T11:15:53.296Z"),
})

Special fields

HubSpot supports the following traits as special fields:

  • address
  • city
  • companyName
  • email
  • firstName
  • lastName
  • position
  • phone
  • zip

Custom properties

RudderStack supports sending custom properties to HubSpot via the identify call. These properties will update the contact property you have already created in HubSpot:

HubSpot create property
info
Refer to the HubSpot Knowledge Base for more information on creating custom properties.

When you provide any custom property in the event, RudderStack automatically converts the field name into the lower case and replaces any space with an underscore. This is because HubSpot does not accept properties in the upper case and spaces.

RudderStack then maps the field values present in the traits to the corresponding HubSpot custom property.

warning
HubSpot discards any property that does not exist and returns a 400 Bad Request error.

Dates

For sending properties of date type, you can send them as the epoch time or as a date object. RudderStack converts them to the required HubSpot format (midnight UTC).

Track

A track call lets you record various user actions and any properties associated with them.

To associate a track call with a user, you need to specify the user’s email under context.traits . Additionally, RudderStack associates the track events with the same user after an identify request is successfully made.

A sample track event is as shown:

rudderanalytics.track(
  "Order Completed", {
    value: 30,
  }, {
    context: {
      traits: {
        firstname: "Alex",
        city: "New Orleans",
        country: "USA",
        phone: "+1-202-555-0146",
        email: "alex@example.com",
      },
    },
  }
)

The track call also supports externalId as a parameter which is mapped from externalID hubspotId. A sample track call containing the externalId is as shown:

rudderanalytics.track(
  "Order Completed", {
  value: 30,
}, {
  context: {
    traits: {
      firstname: "Alex",
      city: "New Orleans",
      country: "USA",
      phone: "+1-202-555-0146",
      email: "alex@example.com",
    },
  },
  externalId: [{
    type: "hubspotId",
    id: "6556"
  }]
})

Revenue events

For the revenue events, a value or revenue key should be included in the event properties to be recorded in HubSpot.

Screen

The screen call lets you record whenever your user views their mobile screen, with any additional information about the viewed screen.

If you have enabled screen views in your Android or iOS app implementation, RudderStack will send this information to HubSpot. RudderStack also forwards the properties you’ve passed along with the screen call without any changes.

A sample screen call sent via the iOS SDK is shown below:

[[RSClient sharedInstance] screen:@"Main"
            properties:@{@"prop_key" : @"prop_value"}];

Questions? Contact us by email or on Slack