The Web Plant Blog

Web hooks in HubSpot Private Apps

Written by Vikram Singh | May 3, 2024 6:17:00 AM

Up until recently, Web hooks were only available for public HubSpot Apps. HubSpot recently announced support for Web hooks in private apps as well.  This may not seem like a big deal if you never had to use a private apps. However, the users of private apps would know that this solves a lot of complications that we have had to handles for a long time.

Here is a typical scenario. You are using HubSpot CRM for maintaining your contacts. You are also using another system that takes contacts data from HubSpot. The other system also needs details of any new contacts that are created and the system also needs to track when certain fields have updated values in certain fields.

How was this handled without Web hooks

Without Web hooks, there would be a private app that would constantly poll HubSpot CRM for updates. There are a few downsides to this approach:

  1. The app uses a lot of API calls and can end up reaching the rate limit of API calls
  2. There is a piece of code that decides if a new or updated record is present in the CRM. In complex scenarios, this is prone to bugs
  3. There is additional computing power that is needed to constantly poll and check for updates

How Web hooks help in this scenario

With Web hooks, our apps don't need to poll anything. The app just needs to have a public endpoint that can consume a json object. Then you set up the Web hooks within HubSpot to monitor the changes that your app needs. Now, whenever a relevant event occurs like a "new contact", "updated contact" etc, the Web hook will send a json to the public endpoint of the app. The app then decides what do with the data instead of having to decide if a valid event has occurred.

How to Set up a Webhook

If you have ever worked with Private Apps in HubSpot, this will feel like a very convenient add-on. But in either case, we have you covered. 

To start, head to the your portal settings and navigate to "Private App" under "Account Setup > Integrations". The URL will be https://app.hubspot.com/private-apps/<your_hub_id>

Now click "Create a Private App" button and you will be presented with a form to fill out the app details.

HubSpot will generate a quirky name for the app that you change by clicking on the pen icon on top. Head over to the last tab call "Webhooks". Here, you will need to provide the URL end point of your app that can receive data from HubSpot when an even occurs. If you don't have an app at the moment, use the service at https://webhook.site/ to generate temporary URL. You can use the URL and provide it to HubSpot webhook Target URL

Now we need to define the events on which we need to receive data from HubSpot. Here, we will take the example of new contact creation. To do this, click on "Create Subscription" link. Then choose "Contact" as Object type and "Created" as event. HubSpot will immediately tell you that you need to add a "Scope" in your app config to receive this data. Simply click on "Add this required scope" and create your app. Make sure to click "Create App" button on top right of the screen after entering webhook information.

Now it's time to run a quick test. Head over to Contacts and simply create a new contact. As soon as you create the contact (or within a few milliseconds), you will see a JSON submission appear on you URL endpoint. If you used webhook.site for testing, it will be clearly visible below your URL details.

and that's it! From here on, the opportunities are endless, you use use HubSpot APIs or external systems' API to work on this data and get about automating your tasks.

At the The Web Plant, we are helping many customers, sync their CRM data with external systems and perform many others automation tasks using Webhooks. To find out more about how this feature and can you save time & money, reach out and drop a note!