# Webhooks - Handling order and uniqueness

**URL:** <https://community.hubspot.com/t/webhooks-handling-order-and-uniqueness/31028>\
**Category:** APIs & Integrations\
**Tags:** webhooks\
**Created:** [January 29, 2021, 11:11pm UTC](https://community.hubspot.com/t/webhooks-handling-order-and-uniqueness/31028 "2021-01-29T23:11:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmr](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmr/32/34870_2.png) [@tmr](https://community.hubspot.com/u/tmr)\
**Post date:** [January 29, 2021, 11:11pm UTC](https://community.hubspot.com/t/webhooks-handling-order-and-uniqueness/31028/1 "2021-01-29T23:11:14Z")

</div>

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**.

Docs at [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/webhooks) mentiones following:

- **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**?

Youre resppnse is much appricaiated!

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [February 1, 2021, 8:54pm UTC](https://community.hubspot.com/t/webhooks-handling-order-and-uniqueness/31028/2 "2021-02-01T20:54:14Z")

</div>

Hey @tmr !

Good question 😀

I think you are on the right track, but maybe [@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259) , @prosa or @daveroma can bring the goal post a little closer!

Do you guys have advice for our friend

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [February 1, 2021, 11:38pm UTC](https://community.hubspot.com/t/webhooks-handling-order-and-uniqueness/31028/3 "2021-02-01T23:38:37Z")

</div>

Hi @tmr

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.

Have fun

Mike

---

<div class="post-metadata">

**Author:** ![tmr](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmr/32/34870_2.png) [@tmr](https://community.hubspot.com/u/tmr)\
**Post date:** [February 17, 2021, 8:17pm UTC](https://community.hubspot.com/t/webhooks-handling-order-and-uniqueness/31028/4 "2021-02-17T20:17:05Z")

</div>

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.
