Skip to content

Setup external hubspot ingestions

Overview

This guide is for ingesting metrics from HubSpot to Generic Reporting.

Prerequisites

giosg

A guide on how to create an API token can be found here

Once you have obtained your API token(s), define the Authorization HTTP header for all your API requests:

1
Authorization: Token <api_key>

You should replace the <api_key> with your API token

Remember that the api token is connected to the user that created the token, which means that if the user is deleted the api token will also be invalidated. You can create an extra user and create the token with this user, remember to name the user so that it doesn’t get deleted by mistake e.g “Reporting api-user do not delete”

HubSpot

  1. You should own a HubSpot App Developer Account, how to create one can be found here
  2. You should create a HubSpot app when your developer account has been activated, a guide can be found here. (Please only follow steps: Creating an app, step 1 & 2).
  3. From step 2, save the App ID and Client Secret for use in this guide.

Setting the client secret to the ingestion platform

To start making use of the ingestion platform we will need to send the client secret from the HubSpot app you just created to the Ingestion Platform.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import requests

GIOSG_SERVICE_BASE_URL = "https://api.giosg.com"
token = "<giosg account token>"
organization_id = "<uuid>"
client_secret = "<client secret from HubSpot>"

json = {
    client_secret: client_secret
}

def store_hs_client_secret():
    response = requests.post("{}/api/ingestions/v1/orgs/{}/hubspot".format(GIOSG_SERVICE_BASE_URL, organization_id), headers={'Authorization': 'Token ' + token}, json=json)
    response.raise_for_status()
    return response.json()

When this is posted you can go to the next step.

Setting up the workflow to send the metrics

Warning

Please keep in mind that currently only DEAL and LEAD objects can be translated to generic events, this endpoint will return HTTP code 422 - UNPROCESSABLE if the type of given object is not supported.

  1. Navigate to your hubspot app.
  2. In the navigation bar, click the Workflows tab.
  3. Select a workflow that you want the metrics from.
  4. Add a Trigger Webhook action.
    1. Fill in the url like the following: api.giosg.com/api/ingestions/v1/orgs/{organization id}/hubspot/{your client secret}/ingest.
    2. Add your previously saved App ID in the similar named field.
  5. Review and start your workflow.

Conclusion

In this tutorial we have learnt how to send hubspot metrics to Generic Reporting. This can then further be used by conversational reporting for instance to track your long term goals.

Endpoints used in this tutorial

  1. https://api.giosg.com/api/ingestions/v1/orgs/{organization id}/hubspot
  2. https://api.giosg.com/api/ingestions/v1/orgs/{organization id}/hubspot/{your client secret}/ingest