Portant Docs

Tutorial: Create a workflow with HubSpot as the source

A worked example of using the Portant Developer API to create a workflow with HubSpot as the source. All requests use cURL. Replace <DEVELOPER_ACCESS_TOKEN> with the token the Portant integrations team gave you.

Tip: before you start, build and run a workflow in the Portant Workflow web app so you're familiar with how workflows work. We recommend a Google Docs template, which also confirms your account is correctly authorised with Google's APIs.

This tutorial assumes you've finished the steps in the Developers overview guide, and that your Portant account is already connected to HubSpot.

Step 1. Create a workflow

We'll name the workflow "Developer Workflow" and create it with the Workflows POST endpoint, passing a HubSpot source.

curl --location --request POST 'https://api.portant.co/v0/workflows/' \
--header 'Authorization: <DEVELOPER_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Developer Workflow",
    "source": {
        "sourceType": "HUBSPOT",
        "hubspotObjectTypeId": "0-3",
        "hubspotProperties": ["0-3.dealname", "0-1.firstname"]
    }
}'

A HubSpot source takes two extra fields alongside sourceType:

hubspotObjectTypeId (String) The primary HubSpot object type for this workflow. This uses HubSpot's own object type ID convention: 0-3, for example, is the object type ID for Deals. See HubSpot's object type ID reference for the full list.

hubspotProperties (Array<String>) The properties to include as source fields for this workflow, each in the format <objectTypeId>.<internalFieldName>, where objectTypeId is the type ID above and internalFieldName is the internal name of that property in HubSpot. In the example above, 0-3.dealname pulls the deal name and 0-1.firstname pulls the associated contact's first name.

A successful request returns 201 Created with the new workflow. Save the id value; you'll use it to add a template next.

Step 2. Add a template and go live

From here the workflow behaves like any other. The remaining steps are identical to the webhook tutorial:

Once the workflow has both a HubSpot source and at least one template, its status becomes "COMPLETE" and it runs whenever a matching HubSpot object triggers it.

For details on every endpoint and resource, browse the rest of the API reference. If you have questions or feature requests, get in touch with the customer success or integrations team.