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.