Hey all,
Using the developer webhooks, hubspot will respond with a payload that looks like this:
[
{
"eventId": "1",
"subscriptionId": "22022",
"portalId": "4466460",
"occurredAt": "1527007125234",
"subscriptionType": "contact.propertyChange",
"attemptNumber": "0",
"objectId": "123",
"changeSource": "CRM",
"propertyName": "hs_email_optout_4799042",
"propertyValue": "sample-value",
"appId": "145851"
}
]
In our app we want hubspot to post the above data to us, then take different actions depending on which webhook posted to us.
Currently, the only way I see to differentiate which webhook has posted to us is from the subscriptionId. This isn't optimal as we need to hardcode the id's throughout our app. It would be much more convenient if hubspot sent across a webhook or subscription name instead. Is the subscriptionId the only way to differentiate between webhooks or is there another way?
Sidenote: Does hubspot always post a payload wrapped in an array, regardless if its a single event or not? This has implications as to how we need to unwrap the data after receiving it so it would be good to have a definitive answer.
Thanks!
Alex