Webhook and Azure Functions

deals

#1

Hi,

I am attempting to use an Azure function as the endpoint for a HubSpot webhook. Here are the steps I have taken:

In HubSpot Development:

  1. I created an app "myApp"
  2. I created a Test Hub
  3. I went through the OAuth2.0 Flow using the Postman app to install my app as an integration in my Test Hub.
  4. I when back to my app "myApp" and created a new webhook subscription that fires when a deal is created. I passed in the function url from my Azure function as my webhook URL and made sure my subscription is 'active'
  5. I created a new deal in my Test Hub.
  6. I went back to my "myApp" and selected 'webhook logging' and saw several logs all showing an HTTP of 400 and a status of failure.
  7. Finally I went to my Azure Function and the logs show that the function is firing but the function is not able to retrieve any data from the JSON payload sent by the webhook.

Has anyone else done this successfully? Any ideas?

Many thanks
Mike


#2

Hi @MikeTurnbull,

Based on some quick research (i.e. Google) I found a couple examples of similar situations (see below). Have you added reference to NewtonSoft.JSON?


#3

Thanks Derek, I'll have a play and let you know :slight_smile:


#4

Hi Derek, thanks for your help. My function is Node.js, and it turns out the JSON payload from HubSpot is wrapped in an array. So instead of querying data.eventId, I had to query data[0].eventId.

All working now :slight_smile:

Thanks again
Mike


#5

Hi @MikeTurnbull,

That would do it; thanks for updating the topic with your solution!