Creating a custom property in HubSpot

Newbie here. I would like to create custom company and contact properties in HubSpot using Python or JSon scripts since there is no built in function in the HubSpot module but it is included in the HubSpot API.

Is there an example available to show me the basics? I have the code but am not sure how to get it to run using N8N.

Hi @davidl, welcome back!

In n8n you’d typically use the HTTP Request node to send custom request to a 3rd party API such as Hubspot. For example, the request to create (not set) a contact property is described here in Hubspot’s docs:

So from reading through this we have:

  • The method: POST
  • The URL: https://api.hubapi.com/properties/v1/contacts/properties
  • The required fields (for a simple string property):
    • name
    • label
    • groupName
    • type
    • fieldType

You can use these details to prepare your HTTP request in n8n:

Here is how it looks in a workflow, no script/code needed:

After running this workflow, your Hubspot account has a new custom contact property:

Hope this helps!

3 Likes

Thanks. That did the job.

1 Like

Hey Friend. Can you help one more time and show me how to add options for enumerators, selects, and checkboxes, etc? Thank you

Hi @davidl, Hubspot provides a list of the required parameters on the doc page I’ve linked above.

Looks like the enumeration type requires the type to be enumeration, the fieldType to be something like select or checkbox and an additional options property:

If the property is the enumeration type, you must include a list of options. These options will be the acceptable values for the property. Each option will have a value and a label. The value is the internal value, used to validate the property and used internally by the APIs. The label should be a human readable value, as the label is displayed in the HubSpot app.

Like so:

Result:

The options field in this example uses an expression in order to build the array needed by Hubspot’s API.

Hope this helps!

Got it. That works. Thank you again.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.