Hello, I’m working on integrating HubSpot Wehooks into one of our applications. I have a basic implementation completed and working. However, there are couple of questions around handling order and uniqueness.
NOTE ON ORDER: We do not guarantee that you get these notifications in the order they occurred. Please use the occurredAt property for each notification to determine when the notification occurred.
NOTE ON UNIQUENESS: We do not guarantee that you will only get a single notification for an event. Though this should be rare, it is possible that we will send you the same notification multiple times.
My questions to more exprienced folks are:
How did you handle order? did you just process all of them from oldest to newest based on occuredAt ?
How did you handle uniqueness? what was the strategy behind just processing unique hook responses? Maybe combination of IDs like eventId and subscriptionId?
The HubSpot API is (I assume) a Job Queue where each call goes into a Queue. My assumption (I don’t work for HubSpot) is that the queue may not be executed in order.
So, what I recommend, if you have dependencies, in your chain of business rules, is to send your jobs to a queue and execute them when the dependency has been executed. It makes you code more complicated but – in the end – that’s the code you have control over.
You will also see in the JSON, from HubSpot, and attempt number. HubSpot’s API is super excitable and if it doesn’t get a response back really quickly then it can have another go at sending you the data. If there’s a failure it may keep trying up to 10 times. So your code will want to keep an eye on the Request ID and Attempt numbers.
Thank for the reply Mike! We are going to move ahead with what I suggesred above. Process them based on occuredAt timestamp and identify uniques based on eventId and subsctriptionId.