How to call MuleSoft API (with client id & client secret) from HubSpot workflow?

Highlighted
Occasional Contributor

There has been a PoC done where the workflow was configured to call Webhook API and that’s working fine.

 

But when we are replacing final endpoint in webhook with Mulesoft API endpoint, the request is not going through successfully and giving SSL Certificate error. We suspect below 2 points which is causing this:

 

  • At MuleSoft, we have a load balancer in place which acts as the primary receptor for all Mule API calls. To interact with it, the calling application needs to import/install a public certificate (which MuleSoft team can provide). But not sure where in HubSpot to get this certificate installed/imported.
  • Further in the API call, MuleSoft has imposed Client ID Enforcement policy, in which every API call must carry client credentials with it. Want to know where can we provide the client credentials in HubSpot for the outwards call from it to MuleSoft.
7 Replies 7
Community Manager

Hey @SurajTGP ,

 

It sounds like you're using a workflow webhook action, and not the Webhooks API, is that correct? The answer here is likely the same for both, but I wanted to make sure to clarify.

 

Neither the workflow webhook action nor the Webhooks API support installing a public certificate, nor do they support including custom credentials (i.e. client id).

 

In order to connect the two systems, I'd imagine you need to accept the webhook notificaitons with your own code, and pass the data along to MuleSoft according to their specifications.

 

Please don't hesitate to reach back out with additional questions if I'm misunderstanding something!

Occasional Contributor

Hi @Derek_Gervais ,

Yes, we are using the workflow webhook action.

 

Can you please explain a bit more by what you intend, when you say "need to accept the webhook notificaitons with your own code"....are you suggesting to do custom development within HubSpot code to listen to webhook notifications generated from the workflow webhook action?
And then send out the payload via a HTTP call (or what will be the other alternative?) to MuleSoft?

I'm from the MuleSoft side and want to explore the option on how to connect both systems (in particular, listen to HubSpot's request made to MuleSoft exposed APIs).

Reply
0 Upvotes
Community Manager

Hey @SurajTGP ,

 

I'm sorry, I wasn't totally clear there. I said that because often, people expect that the webhook HubSpot sends will be directly compatible with the API of an external system. This is generally not the case; usually, it's necessary to write some middleware that accepts the HubSpot webhook, performs some transformation, and then sends that data to the external system.

 

So to be clear, you don't have to do any custom work in HubSpot; you just need to facilitate the interaction between HubSpot's webhook and the MuleSoft API. In practice, this often means accepting the HubSpot webhook, transforming it, and then sending it out via HTTP to an external platform, but that isn't always the case. Given your familiarity with MuleSoft, you'll likely be better positioned to understand the work nesecary to pass HubSpot data into MuleSoft.

Reply
0 Upvotes
Occasional Contributor

Hello @Derek_Gervais ,

True, I was under impression "that the webhook HubSpot sends will be directly compatible with the API of an external system" .
Now if, "it's necessary to write some middleware that accepts the HubSpot webhook, performs some transformation, and then sends that data to the external system" - MuleSoft is the middleware which is also not able to accept the webhook, because of it's organisation laid security specifications.

How to facilitate the interaction between HubSpot's webhook and the MuleSoft API ?
Can you please recommend of any other middleware who accepts the webhook and send to MuleSoft API with the custom headers?

Any reference to already implemented project which accepts HubSpot's webhook data and then sends out a custom HTTP call would also be very helpful.

Reply
0 Upvotes
Community Manager

Hey @SurajTGP ,

 

I'm not currently aware of any existing projects that accept HubSpot webhooks and send them elsewhere. In my experience, most projects created to accept HubSpot webhooks are single-purpose and dedicated to a particular integration.

 

In this case, it's likely you'll need to either use an IPaaS solution like Zapier (see here for an interesting use case of using Zapier to tweak webhook messages), or write the middleware to handle these webhooks yourself (unless another community member has heard of a project to handle HubSpot webhooks & send them to another platform). 

Occasional Contributor

Hello @Derek_Gervais 

 

As a solution to the problem above, we are customizing/adatping our Mule APIs to accept the webhook call from the workflow, by removing the Client ID enforcement policy and also made changes to resolve SSL handshake error.

 

However, removing client id and client secret from API level, we are exposing our API to security risks. As a solution to this, we want to allow only HubSpot webhook calls to our API and hence are thinking to whitelist just the HubSpot webhook IPs.

 

Can you please let me know what is the IP range for this traffic coming from HubSpot webhook call ?

Reply
0 Upvotes
Community Manager

Hey @SurajTGP ,

 

Webhooks are sent from a large and dynamic range of IP addresses, so it's not possible to create an IP whitelist for webhook IPs. Instead, you'll want to validate the X-HubSpot-Signature header to ensure that the requests are coming from HubSpot. See here for more details:

https://developers.hubspot.com/docs/methods/webhooks/webhooks-overview#security