APIs & Integrations

gotmike
Top Contributor

Webhook Working on Postman, Broken on App?

SOLVE

ok, so i have a working webhook, gives a valid response in postman.

 

running on my app, gives an HTTP 400 error.

 

one of the many attempt id's...

 

223026-4150746213-3

 

 

another one (two different webhooks)...

 

223027-3678687883-3

 

 

i am literally going into the hubspot developer app, monitoring section and copy/pasting the payload into postman with the same exact endpoint.

 

mine gives an HTTP 200 OK and valid response.

 

the live gives HTTP 400 BAD REQUEST.

 

i'm not sure how to debug this... any suggestions?

0 Upvotes
1 Accepted solution
gotmike
Solution
Top Contributor

Webhook Working on Postman, Broken on App?

SOLVE

okay, so here was the problem...

when you use the developer console to monitor the webhooks, it lists a payload that looks like this...

{
  "eventId": 1234,
  "subscriptionId": 1234,
  "portalId": 1234,
  "appId": 1234,
  "occurredAt": 1234,
  "subscriptionType": "deal.propertyChange",
  "attemptNumber": 0,
  "objectId": 1234,
  "propertyName": "dealstage",
  "propertyValue": "contact_made",
  "changeSource": "CRM_UI"
}

but that's not actually what gets sent. in the hubspot docs, it clearly states that it may send up to 100 at a time, but must be that in the developer console it doesn't actually show you the true payload that it sends. you only see the individual payload entries.

 

so, when i was trying to parse the JSON, i needed to change the code to accept what HubSpot ACTUALLY sends, which looks like this...

[
  {
    "eventId": 1234,
    "subscriptionId": 1234,
    "portalId": 1234,
    "appId": 1234,
    "occurredAt": 1234,
    "subscriptionType": "deal.propertyChange",
    "attemptNumber": 0,
    "objectId": 1234,
    "propertyName": "dealstage",
    "propertyValue": "contact_made",
    "changeSource": "CRM_UI"
  }
]

 which means instead of looking for a single object, the code needs to look for the array.

 

all is fine, but i think the developer console should be modified to give the actual payload that was sent to the endpoint, otherwise it confuses the debugging process.

View solution in original post

1 Reply 1
gotmike
Solution
Top Contributor

Webhook Working on Postman, Broken on App?

SOLVE

okay, so here was the problem...

when you use the developer console to monitor the webhooks, it lists a payload that looks like this...

{
  "eventId": 1234,
  "subscriptionId": 1234,
  "portalId": 1234,
  "appId": 1234,
  "occurredAt": 1234,
  "subscriptionType": "deal.propertyChange",
  "attemptNumber": 0,
  "objectId": 1234,
  "propertyName": "dealstage",
  "propertyValue": "contact_made",
  "changeSource": "CRM_UI"
}

but that's not actually what gets sent. in the hubspot docs, it clearly states that it may send up to 100 at a time, but must be that in the developer console it doesn't actually show you the true payload that it sends. you only see the individual payload entries.

 

so, when i was trying to parse the JSON, i needed to change the code to accept what HubSpot ACTUALLY sends, which looks like this...

[
  {
    "eventId": 1234,
    "subscriptionId": 1234,
    "portalId": 1234,
    "appId": 1234,
    "occurredAt": 1234,
    "subscriptionType": "deal.propertyChange",
    "attemptNumber": 0,
    "objectId": 1234,
    "propertyName": "dealstage",
    "propertyValue": "contact_made",
    "changeSource": "CRM_UI"
  }
]

 which means instead of looking for a single object, the code needs to look for the array.

 

all is fine, but i think the developer console should be modified to give the actual payload that was sent to the endpoint, otherwise it confuses the debugging process.