Webhook and Azure Functions

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

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?

stackoverflow.com

How can I Parse Json in a Azure Function

json, azure, azure-functions

asked by
Boris Pluimvee
on 08:26AM - 29 Jun 16

docs.microsoft.com

Azure Functions HTTP and webhook bindings

Understand how to use HTTP and webhook triggers and bindings in Azure Functions.

Thanks Derek, I’ll have a play and let you know
slightly_smiling_face.png

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

Thanks again
Mike

Hi @MikeTurnbull,

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