Duplicate Webhook Received

Hi Everyone, We were working on webhooks but were occasionally receiving duplicate webhooks. What is the response waiting time for webhooks?

Yes, it’s possible that Shopify might send duplicate webhooks. This is unexpected but possible behavior.

If you want, you can use the X-Shopify-Event-Id header in the webhook request to differentiate between duplicate events:

However, I personally just make my subscribing webhook handler routes idempotent so I don’t have to worry about multiple redundant events.

Hi @Developer

You can verify duplicate webhooks based on the webhook_id: “X-Shopify-Webhook-Id”

Hi @kyle_liu and @Dylan, Thanks for the help. I also wanted to know the waiting time for a webhook sent from Shopify’s end. At our end, it might take 10 seconds or about 20 seconds to process and return a response as 200, because previously I saw in docs referring to waiting time as 5 seconds but could not find it in docs now.

you can save the webhook first and return it. The backend service of your application will then slowly process the saved messages.

The previous document is no longer available, but based on my webhook records, the conclusion is as follows: retry 8 times, with retry intervals of 1 second, 1 minute, 2 minutes, 5 minutes, 22 minutes, 30 minutes, 1 hour, 2 hours.

your right.response time should be within 5 secs

Hey @Dylan, how do you go about doing that? Do you store the webhooks id in a table and check if it hasn’t been stored yet before processing?

Sure, you could do it that way.

But instead I prefer to design any individual webhook or background job to run multiple times and still produce the same output. You can take it a step further and add a guard that checks the current state of your database or 3rd party API and skip processing if there is no action required.

From the MDN docs:

An HTTP method is idempotent if the intended effect on the server of making a single request is the same as the effect of making several identical requests.

An idempotent operation can be repeated an arbitrary number of times and the result will be the same as if it had been done only once.