# Webhook and Azure Functions

**URL:** <https://community.hubspot.com/t/webhook-and-azure-functions/11832>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [February 26, 2018, 4:58pm UTC](https://community.hubspot.com/t/webhook-and-azure-functions/11832 "2018-02-26T16:58:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [February 26, 2018, 4:58pm UTC](https://community.hubspot.com/t/webhook-and-azure-functions/11832/1 "2018-02-26T16:58:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Derek\_Gervais](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/derek_gervais/32/17429_2.png) [@Derek\_Gervais](https://community.hubspot.com/u/Derek_Gervais)\
**Post date:** [February 27, 2018, 3:11pm UTC](https://community.hubspot.com/t/webhook-and-azure-functions/11832/2 "2018-02-27T15:11:25Z")

</div>

Hi [@MikeTurnbull](https://community.hubspot.com/u/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](https://stackoverflow.com/questions/38094170/how-can-i-parse-json-in-a-azure-function) [  
  ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/0/a0c37b0f235dc0d51d8fd7d9a262668a4a014571.png)  
 ](https://stackoverflow.com/users/6496053/boris-pluimvee)

#### 

[How can I Parse Json in a Azure Function](https://stackoverflow.com/questions/38094170/how-can-i-parse-json-in-a-azure-function)

**json, azure, azure-functions**

asked by [  
Boris Pluimvee  
 ](https://stackoverflow.com/users/6496053/boris-pluimvee) on [08:26AM - 29 Jun 16](https://stackoverflow.com/questions/38094170/how-can-i-parse-json-in-a-azure-function)

[docs.microsoft.com](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#trigger---webhook-example)

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/0/f/0f1d74890eaa18cb7a2b7b455c33358ebf0cec19.png)

### [Azure Functions HTTP and webhook bindings](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#trigger---webhook-example)

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

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [February 27, 2018, 4:38pm UTC](https://community.hubspot.com/t/webhook-and-azure-functions/11832/3 "2018-02-27T16:38:29Z")

</div>

Thanks Derek, I’ll have a play and let you know  
 ![slightly_smiling_face.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/2/42c4d129a1c6aa74d89f3066ee8fbb15db46b3b5.png)

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [March 5, 2018, 5:52pm UTC](https://community.hubspot.com/t/webhook-and-azure-functions/11832/4 "2018-03-05T17:52:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Derek\_Gervais](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/derek_gervais/32/17429_2.png) [@Derek\_Gervais](https://community.hubspot.com/u/Derek_Gervais)\
**Post date:** [March 6, 2018, 7:57pm UTC](https://community.hubspot.com/t/webhook-and-azure-functions/11832/5 "2018-03-06T19:57:28Z")

</div>

Hi [@MikeTurnbull](https://community.hubspot.com/u/miketurnbull),

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