HubSpot provides a powerful combination of customer relationship management (CRM) features and insights that can help organize and maintain business processes tied to customers. Drupal is a key digital platform for businesses, especially for inbound customer engagement, marketing initiatives, and 3rd party integrations. The two systems are highly complementary and deserve consideration for logically separating the responsibilities of digital engagement and customer relationship management. Additionally, both HubSpot and Drupal are very flexible and customizable. As an example, both systems support extensible data structures through custom fields in HubSpot and through the entity system in Drupal that allow for implementation-specific data to be stored and maintained.
Federated Drupal + HubSpot Approach
So you like the idea of using a CRM, but is it really worth all the trouble to integrate it tightly with your Drupal site? Are you afraid of commitment? There’s an interim step you can take before getting married to using HubSpot as your CRM.
If your data isn’t updated multiple times a day, you can work with HubSpot without tightly coupling your data integration. This approach involves using HubSpot’s batch update API. For example, with a regularly scheduled job to grab your active records and upload the relevant fields, you can keep HubSpot aware of your more recent data such as contact information. You get all of the HubSpot goodness without having to change your Drupal code since you get the data directly from your database.
We applied this approach for a Drupal system that isn't really a standard "website" but, instead, a very complex web application with a regularly-updated, separate data warehouse. Users are selected for data inclusion after a series of prior steps involving the end user, customer relations, and third parties. There are hundreds of these records a day which is only a very tiny subset of the site's daily data.
This approach leveraged the data warehouse in AWS, but you could do it against your production database as long as you keep an eye on query efficiency and server load. A CRON job to retrieve updated data was implemented in AWS Lambda, their serverless code platform, but it could also be implemented with a CRON hook in Drupal. While Lambda offers lots of coding choices, PHP isn’t one of them. Fortunately Python is. This approach also allowed us to rapidly prototype and implement our solution without impacting the production system.
Lambda jobs automatically log their output with AWS CloudWatch. After becoming familiar with HubSpot API errors, we built CloudWatch alarms which report to Simple Notification Service (SNS) for notification.
Unified Drupal + HubSpot Approach
While it's more advanced and complex, Drupal’s APIs allow for a much more refined, tighter integration if it is desirable. HubSpot maintains web service APIs for all of its various data objects. Developers can leverage these APIs and the various hooks/events within Drupal to synchronize data bidirectionally.
One common use case is a form in Drupal that end users engage with. The HubSpot module offers Webform integration specifically to HubSpot’s Leads feature. This is a concise, but relevant, single-direction use case in which Drupal can send Webform submissions to HubSpot. This allows for capturing inbound leads within a Drupal system and synchronizing that data to HubSpot.
Drupal’s development framework also supports more nuanced and implementation-specific approaches beyond just the Drupal Webform and HubSpot Leads integration. The HubSpot API module leverages a Composer dependency and Drupal service to integrate a PHP SDK within the Drupal application. This service can be programmatically invoked in any Drupal hook or event. Most CRUD-related runtime hooks programmed into a module allow for any data or transaction to be sent to a corresponding HubSpot entity. For instance, having a user-related hook to synchronize specific Drupal users with HubSpot customers can allow for interactive Drupal applications (commerce, collaboration platforms, etc.) to automatically send customer-related information from Drupal user profiles.
Drupal offers other advanced integration options with HubSpot. Drupal’s CRON system can be used to routinely pull data from HubSpot. This is helpful for creating advanced dashboards and data visualization within Drupal that is potentially tied to a single user-based experience. For instance, a user in Drupal could have a unified experience in which their HubSpot campaign data can be shown in a single dashboard in Drupal without potentially having to log into multiple systems.
The user-based example can be extended with some other key features of Drupal’s provided framework:
- Drupal’s Entity API can be used to create a custom entity to track unprocessed users and the state of HubSpot-related operations within Drupal.
- Reports can be generated in Views to easily list the tracked entities, like when they were created, when they were processed, their state, and more.
- Drupal’s log subsystem can maintain the set of activities tied to the user tracking entities and store HubSpot-generated responses from the API. This helps with failures, which is common for large scale sites with HubSpot’s API rate limiting.
- Drupal’s queue subsystem can offer opportunities to leverage CRON in staggering user requests instead of at runtime. This is advantageous should the HubSpot API go down or have slow performance, as there is a built-in failure state. Additionally, operations can be batched which helps avoid hitting API rate limits.
Drupal and HubSpot have a lot to offer each other as complementary solutions. Whether you want a more lightweight, federated approach or a tightly-coupled integrated approach, both Drupal and HubSpot offer enough extensibility through their frameworks and APIs to make even the most complex of use cases happen.