Welcome to the third installment of the HubSpot API series. In the last post of this series we looked at a few of the most common HubSpot API endpoints and how they could be used. In this post we are going to look specifically at the HubSpot Workflows API.
Everyone who has spent any amount of time in their HubSpot portal knows how powerful and indispensable workflows can be, but by tapping into the API built to create, update and delete these workflows you unlock the potential for truly dynamic marketing automation.
In addition to simply being able to generate workflows dynamically, this HubSpot API endpoint allows you to integrate your external website seamlessly.
How The HubSpot Workflow API Works
The HubSpot workflows tool allows you two options for enrolling contacts in a workflow. One option is to set up the workflow to be integrated with a list, so that all members of a list are automatically enrolled in a workflow. The second option is to manually enroll contacts through the interface. If you need greater conrol over your workflow enrollments, look no further than the Workflows API...
Using the Workflows API, you can create your own custom triggers for workflow enrollment if the list building filters aren't specific enough for your tastes.
The Workflows API does a lot more than just allowing custom workflow enrollment. It allows you to create new workflows right from your code. Basically what that means is as a developer I can build an application for HubSpot that removes the pain of installation from the hands of the user and allows my application to control how HubSpot interacts with it.
An example of this would be a HubSpot integration with GoToWebinar, where the end user would access the application interface and select webinars from their account to integrate into HubSpot. The application then creates a new registration form for each webinar and a workflow for each one that sends the registrant data back to the application so it can then register the user in GoToWebinar -- all automatically from the API.
HubSpot Workflows with Webhooks
Another critical automation feature in the Workflows API is webhooks. A webhook is a way of requesting contact info in real-time when the workflow triggers. This has allowed us to implement dynamic emails where the email content is generated from an external system, but is sent via HubSpot to take advantage of all the tracking HubSpot has to offer.
You can also use webhooks for custom CRM, ERP or E-commerce integrations. We use webhooks with the Workflows API to fully integrate HubSpot and a CRM and to provide seamless, instant syncronization.
Any limititations of the HubSpot UI are obliterated with webhook workflows and the full power of your portal can be unleashed.
Workflow API Reports and Event Flow
While the single greatest component of the Workflow API is the ability to create, delete and update workflows from code, another important aspect of it is the ability to interpret the status of those events from the code.
Without this ability to poll HubSpot for log entries and event status, programmers have to trust that once they make the request to HubSpot that it will be fulfilled. The rest of their code has to be built with the assumption that the events fired off without a hitch. Luckily, the Workflows API has two actions to help our developers out here.
- With the log events action a HubSpot developer can retrieve a list of logged events that have occured for a given contact in a given workflow. By filtering through this list of events we can determine if our workflow was correctly triggered and then we can perform additional logic based on the success or failure of the event.
- In addition to that we can also send a request to the Upcoming Events action which will retrieve a list of scheduled events for a given contact in the workflow. This is another way of determining if our action has occured yet, or if we need to pause our integration script to allow for the workflow to complete before continuing.
Endless Possibilities For Marketing Automation
As you can tell from this article, workflows are one of my favorite elements of the HubSpot API. And now, thanks to HubSpot's awesome API team, we have greatly expanded documentation on how to fully utilize the WorkFlows API!
I hope you're as excited as I am by the possiblities that this API opens up! I'd love to hear any examples you have from using the Workflows API.