How to integrate Hubspot with anything — and build your own tools

Published Jul 20, 2017
How to integrate Hubspot with anything — and build your own tools

Integrate Hubspot with everything else your clients use & run customised reports using raw Hubspot data

In one single year, the marketing technology landscape has grown by 40%, with up to more than 5,000 solutions now available. Chances are that you (and your clients) are already using a lot of different tools for marketing and that you’ve had to get them working with each other at some point.

If your clients are Hubspot users, you’re in good hands as Hubspot offers a lot of flexibility to integrate with other tools. This integration can be achieved in three ways, which I’ll run through in this article. The third option (and the option that I find the most interesting) gives you complete access to all the data and events of your client’s Hubspot portal.

Integrations

The first place to look at is the integrations directory. You might find exactly the integration you need to either:
 — export Hubspot data/events into a 3rd party software (eg for scheduling meetings, generating invoices or populate a reporting dashboard)
 — update your Hubspot database from external data/events (eg from a lead generation form, a customer support platform or survey results)
Sometimes, existing integrations might not let you do exactly what you want, like not importing all the data fields you need or not responding to some events.


Hubspot’s CEO Brian Halligan presenting Hubspot Connect

Webhooks

If none of the existing integrations meets your needs, the next option Hubspot offers is to push events to 3rd party applications through webhooks. 
Sometimes referred to as reverse API, webhooks are user-defined HTTP callbacks to an external service, usually triggered when an pre-defined event occurs. The fact that Hubspot supports webhooks means that you can get another marketing tool programmatically notified when an event occurs for one of your Hubspot contacts, companies or deals:
 — a property change on a contact / company / deal
 — a new contact / company / deal is created
 — an existing contact / company / deal is deleted


Setup a webhook for when a contact is deleted

Since webhooks are triggered on events, they can be used to start external workflows in another application.
If you want to read more about how to set up webhooks in Hubspot, I’ve written about it here.
Note that webhooks can also be set up from inside your Hubspot workflows, to notify a 3rd party software when a contact reaches a pre-defined state.

For example, webhooks are a great way to start Zapier tasks, which might in return let you update data in a 3rd party software. The standard Zapier-Hubspot integration is quite limited, but adding your own webhooks will help. More info here.


A Hubspot webhook captured in Runscope.com for debugging

Using raw Hubspot data

But what if you can’t find the integration you want, if it’s lacking features, or if you want to develop your own reporting tool for your clients?

Hubspot lets you download contacts, companies and deals as a CSV or XLS file, however the files won’t include the entities’ unique identifiants (IDs below). This means that:
 — relationships aren’t preserved (which company a contact belongs to, which companies a deal is associated with etc)
 — you can’t sync your changes back to Hubspot without the IDs

So, to integrate deeper with your Hubspot data, Hubspot offers a comprehensive API. An API (Application Programming Interface) is what programming scripts plug into to pull/push data into/out of an existing software.
Hubspot API is what the official integrations are built on top of, and since its access is public, it is also how you can create your own integration.

Hubspot API is well designed, formats data in JSON and provides endpoints for everything: all of the data you see in your portal is accessible programmatically.


A JSON payload of the last created Hubspot contacts

So what can it be used for? One business problem it can help solve is to run custom queries on Hubspot data. If you need to create lists based on Contacts / Companies / Deals / Owners and Tasks properties all at once, the only way will be to interface the Hubspot API. The List tool in the Sales module only lets you query properties for one given property.
The Marketing module allows more powerful segmentation through workflows, however Tasks-based queries aren’t available.
If you want to rotate leads based on what Tasks are planned for each company, the portal does not support it.

I want a list of all my contacts who have been last called more than 100 days ago, for a deal value of more than £1,000 and who have no associated task planned in the next 2 weeks.

To satisfy such a business requirement, one could import all of Hubspot’s data into a traditional database, one that will allow the use of a standard Query Language like SQL, writing queries based on just about anything.
It takes 2 steps to do so with the API:
 — one initial data dump, making sure to include all your custom fields
 — an ongoing update of the database by setting up webhooks on changes or pulling the latest modified/created contacts/companies/deals.

From there, with enough knowledge of SQL, you can create lists based on the most intricate criteria in seconds and make any report possible.
Since you would have saved the IDs, you could sync back into Hubspot any update in your replicated database (properties or associations) using the API again.

For example, you can:
 — fix contacts-companies associations (one database I worked with had thousands of contacts with a company_name field but no company associated, the link has been restored in one request)
 — find company duplicates
 — rotate leads only for companies with no planned Task
 — find contact / find company / email contacts within Zapier instead of Hubspot Workflows
 — create alerts that involve Tasks or Calls (for example based on volume change)
 — set up white-label reporting for your clients
 — segment and score leads based on lead activity from a 3rd party software
 — send custom surveys to your leads


An SQL query showing companies in Lead lifecycle stage with no task planned either on the company or any of its associated contacts

You can also import data from other marketing tools and merge it into the same database to create multi-sources queries and reports. Any data in another software can then be used to enhance your Hubspot database, just like the Wistia integration lets you update your lead score based on lead viewing usage. The possibilities are endless.

Not every marketing tool will let you do this. With Hubspot’s API, it’s good to know that you’ll never be stuck. If you fear that your specific needs may go beyond what Hubspot Lists and Workflows currently feature, you will always be able to extend it by interfacing the API.


Want me to send you a more detailed use case? Like this article and shoot me a message on LinkedIn!

Discover and read more posts from Lionel Martin
get started
Enjoy this post?

Leave a like and comment for Lionel