Solved

Webhook being called twice

Piyush_Diwaker1
Visitor
3 0 0

Hi,

I have created product webhooks for my store. so that if anyone product is created, sometimes the webhook is triggered two times, though it successively hit my destination URL. Even I have returned the response as HTTP 200 OK status to Shopify.

In Shopify, they have specified that they will trigger webhooks again within less than 5s when it didn't get a response.
In my case, I return a response in less than 5 sec.

Accepted Solution (1)
awwdam
Shopify Staff
249 42 36

This is an accepted solution.

Hey @Piyush_Diwaker1 

Thanks for sharing those, I was able to take a closer look on our end and wanted to update you here.

In cases when you 1) create a product (product/create) and assign a publication status 2) publish that product (product/update) there would be a trigger for both of these webhooks. This is actually expected functionality, even when processed through a single payload. More insights can be found in our webhook metrics tracking resource, which goes over locating delivery logs as well as linking some other useful webhook related docs and tools.

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 5 (5)

awwdam
Shopify Staff
249 42 36

Hey @Piyush_Diwaker1 ,

Are you managing your webhooks with the Admin API, or are you setting them up manually from within a store's Settings > Notifications?

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Piyush_Diwaker1
Visitor
3 0 0

Yes. I'm managing my webhooks with the Admin API and for my store, there are only two webhooks that exist for Product creation and Product update.

awwdam
Shopify Staff
249 42 36

Hey @Piyush_Diwaker1, thanks for clarifying.

In that case, would you be able to provide the X-Shopify-Webhook-Id for both separate payloads that you are receiving? With those I would be happy to take a closer look. 

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Piyush_Diwaker1
Visitor
3 0 0

Hi @awwdam 

I have created a product with multiple variants and webhook invoke twice.

First for product creation 'X-Shopify-Webhook-Id': 'b3b945fc-70ee-446a-8b11-9e490125819f' & Second for product update 'X-Shopify-Webhook-Id': '828262df-76d7-481f-ba40-3d0013addf90'.

But webhook for product update invoke without product update operation.

awwdam
Shopify Staff
249 42 36

This is an accepted solution.

Hey @Piyush_Diwaker1 

Thanks for sharing those, I was able to take a closer look on our end and wanted to update you here.

In cases when you 1) create a product (product/create) and assign a publication status 2) publish that product (product/update) there would be a trigger for both of these webhooks. This is actually expected functionality, even when processed through a single payload. More insights can be found in our webhook metrics tracking resource, which goes over locating delivery logs as well as linking some other useful webhook related docs and tools.

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog