May 20, 2019 David Hallinan Connectors, Engineering, Product The Pitfalls of API Integration Services: HubSpot Edition “If you light a lamp for somebody, it will also brighten your path.” Buddha Here at Kloudless, tens of thousands of hours have been spent learning the intricacies of the APIs we provide connections with. Our developers have toiled long days and nights in the pursuit of a deep understanding of the services we allow applications to integrate with, not only in the aim of bolstering our own product but also for the self-betterment that comes with the true comprehension of an outside service. They say that mastery of a subject or profession comes with 10,000 hours of practice. If that much is true, we like to think we’ve mastered a couple of APIs at this point. In the vein of the quote that preceded this piece, we’d like to light the metaphorical lamp of API integrations for others that come after us. In this article, the first in a series of guides aimed to help you navigate the pitfalls of specific APIs, we will attempt to walk you through the trials and tribulations we went through when integrating with HubSpot, one of our more popular API offerings, in the hope that you can be prepared for the development speedbumps you might encounter while incorporating HubSpot into your application. Tech Marks The HubSpot HubSpot primarily creates powerful software products to manage inbound marketing and sales. Besides offering tools for social media marketing, content management, web analytics, and search engine optimization, HubSpot also offers integration with a host of popular CRM platforms like Salesforce, SugarCRM, and more. HubSpot has also been referred to as “a prolific creator of content,” based on the sheer amount of blog posts, social media posts, webinars, and white papers they have published. HubSpot has cemented itself as a major player in marketing software, bringing in over half a billion dollars in revenue each year. As a result, HubSpot continues to be one of our most utilized API connectors here at Kloudless. The Problem Kloudless requires access to HubSpot’s CRM resource objects to provide its users with the necessary functionality to obtain and manage their CRM workflows. While HubSpot provides a myriad of options to obtain the required resource objects, they are often joined through an incredibly deep set of relations that can be burdensome to parse for the data called for in a specific instance. We wanted to be able to filter resources like contacts and deals with their associated company ID, but that proved to be much harder than we had expected. Although HubSpot provides several endpoints to filter by these details, some of the returning data formats were wildly different and required considerable effort to finish even a single filtering feature for only two resources. To add to that, their “Search for contacts by company name” endpoint outlined in their documentation seemingly returned data that was not usable for our needs after intense testing on our part. Providing the necessary functionality for our users was proving to be difficult to achieve, so we set about trying to learn the best ways to tackle the issue that had presented itself. The Solution One of our engineers in our Taipei office, Li-Hsing Chen, was tasked with building our features dedicated to filtering HubSpot responses by related resources. At first, Li-Hsing relented that his work was cumbersome as he was essentially forced to query each and every possible iteration of associated resources to see what the returned response objects would look like. In order to get a better bearing on the assortment of responses with no clear formatting framework, Li-Hsing systematically queried each of the required endpoints alone to see what the returns would bring. He then began by adding one necessary association at a time and re-querying to see what changes would occur to the objects from his prior tests. He repeated this process until a clear outline started to take shape as to what the expected response object would be. Only after testing each and every endpoint against what his expected response data was, Li-Hsing began to notice a pattern that would help him begin to implement Kloudless’ necessary functionality. While tiresome, this process helped him to learn much of the underlying logic that governed the API responses, allowing him to take the necessary steps to filter the correct contact and deal data that was required. In Closing Despite the massive amount of time that went into querying so many endpoints, Li-Hsing was successful in implementing this important functionality into the Kloudless Unified CRM API. As a result, he gained a deep and in-depth knowledge of the HubSpot API that provided Kloudless with a roadmap for going forward with the industry-leading software. Our future features that integrate with the HubSpot API will no doubt benefit from his hard work and dedication to this task. Often, updating functionality in API integrations is not exactly what you would call a “glamorous process.” There are a profound amount of things that can break when an API changes anything about the format of their returns and dealing with the ensuing chaos of broken functionality can be enough to make some developers throw in the towel. As a result, some developers and product managers choose to go with a unified API, such as Kloudless, for their integrations to save themselves the time and stress that goes along with updating functionality after an API update or versioning change. At the end of the day, however, Li-Hsing rose to the occasion and built an integral part of our HubSpot functionality in the Kloudless Unified CRM API. We hope that when deciding to incorporate HubSpot functionality into your application, you’ll go in prepared for what to expect thanks to Li-Hsing’s experience. We would love to hear from you about any pitfalls you’ve had while integrating with any of the APIs covered in this series. Please write to us at firstname.lastname@example.org and let us know any and all of the problems you may have encountered while wading through the swamp of API integrations. Please stay tuned for our next installment in the series, The Pitfalls of API Integration Services: SharePoint Online Edition.