Workflows

How do I use webhooks with HubSpot Workflows?

Last updated: December 13, 2016

Available For:

Product: HubSpot Marketing
Subscription: Professional & Enterprise

This article is for web developers who want to use the webhooks feature of Workflows to pass information from HubSpot to another web application.


What are webhooks?

Webhooks are used to send data from one web application to another after an action is completed in the source application. Just as emails are messages between humans, webhooks are messages between software platforms via an http request. You can use webhooks to send data, notifications, alerts, or any other real-time updates. In short, webhooks present a really powerful way to automate your marketing, allowing you to send data from one application or system to another.

Common use cases and examples

Examples of popular use cases for webhooks include:

  • Posting HubSpot Contacts data to another system, such as a CRM, when that contact fills out a particular form on your site.

  • Sending Contact data into an external system that creates a trial of the software for the contact.

  • Chat alerts sent from your external system to your company's chat stream that lets employees know something important has happened.

How do you set one up in HubSpot?

  • In your HubSpot Marketing account, navigate to ContactsWorkflows.
  • Create a workflow or edit an existing workflow.
  • Click the plus icon to add a new action, then select Trigger a webhook
  • Choose GET or POST from the dropdown.
    • GET - sends a GET request to the specified URL
    • POST - sends a POST request (submits data) to the specified URL
  • Enter the webhook URL.
  • If the request to your system requires authentication, check the Use authentication? box and add a username and password. In this case, the user agent employs the authentication header. Basically, the username and password are combined into a string ("username:password"), which is then encoded (Basic Base64).
  • Click Save.
User-added image

How do you test it?

After you have created your workflow with a webhook action, you can do a really quick test with a dummy webhook URL. Go to http://requestb.in/ and create a Request Bin. Please note that requestb.in may truncate your results if over a certain character limit. Use that URL as the webhook URL in your webhook action.

User-added image
Now enroll a contact by visiting an individual Contact record > Workflows >Select an Active Workflow > Enroll Contact.

Here is an example of the Request Body of the webhook from above, which reveals meta information about the specific contact, including contact information, form submissions, list memberships, etc. When the workflow action is triggered, HubSpot sent the Contact's entire record formatted in JSON to the specified URL.

User-added image
User-added image

The receiving system can then parse that JSON data, and use it for its own application.

For additional information about webhooks, check out the webhooks reference documentation. If you have additional questions about your specific implementation of webhooks with HubSpot, please reach out on developers.hubspot.com/forum.