HubSpot and Drupal logo

Connecting Drupal to the HubSpot CRM v3 API

HubSpot describes itself as ‘the worldwide leader in inbound marketing, sales, and customer service/support training.’ It is a very popular CRM solution. In mid-2022, HubSpot's API and Drupal were disconnected, leaving hundreds of customers without a connection between their website and CRM due to a conceptual change in HubSpot’s new API. 

We found ourselves among those struggling with this change. Driven by our commitment to open-source solutions and sustainable practices, we rose to the occasion and lent a hand to the Drupal community by creating a working integration module.

The Problem

The Drupal HubSpot integration module named HubSpot API is still using the legacy PHP library built for the legacy Hubspot APIs. You can view all of the technical details on Drupal.org
Within this there is an important data model change, according to the Hubspot migration guide:

Those who used the externalObjectId field to sync objects would now need to maintain the HubSpot record IDs for each record in their system.

This problem has grown further as the old APIs are no longer available and the externalObjectIds are not available with the new APIs. As a result, the old mappings are lost for all Drupal sites that did not resolve this with custom solutions. This included our own client, L’moor.

The Solution

We resolved this issue, not only for L’Moor, but for the entire Drupal community. This was done by creating an open-source module that fixes the Drupal and HubSpot integrations. The module is now available for download and our team constantly monitors it for issues and bugs. 
https://www.drupal.org/project/hubspot_client

The main features of this module include:

  • Sync HubSpot IDs to Drupal if desired to map existing Hubspot objects with Drupal. We Implemented mapping for Contacts, Deals (including Line items and Products), and the module is extensible with custom mappings to support entities.
  • Sync Drupal data to HubSpot to populate and update HubSpot objects.

Though our solution is implemented in more detail for Drupal Commerce integrations, it retains a certain versatility. While our solution may not cover every scenario out of the box, its extensible design allows it to be stretched to suit varying needs (For more details, see the module page and the readme).

Thanks to L’Moor for allowing us to use their website as a case study and  HubSpot for supporting our approach and effort.

Do you have any questions?

Send message
Peter Pónya
CTO, co-owner

As a CTO, I'm responsible for outlining and evaluating technical solutions and strategic approaches.

Published at: