Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi everyone,
We are currently developing an app for Shopify which relies on periodic status updates to function. We are considering implementing those status updates as webhooks. However, as webhook delivery is not guaranteed, we also need a reconciliation job.
The status changes that interest us are whether an order has been shipped/cancelled/returned. There are reasonable webhooks for each of these, but the basic resource for these events is unfortunately "orders", a constantly updating large pool of information.
Our current reconciliation approach would see us
However, that is two subsequent requests per event with possible pagination and a decently large volume of data to process. I.e. we're basically just querying the majority of orders several times over, once for each event that we're interested in.
My questions:
We've gotten to the point of considering not using webhooks, as a reconciliation function at a regular interval would fulfill mostly the same requirements.
Cheers and thank you to all who would take the time to answer some questions 🙂
Solved! Go to the solution
This is an accepted solution.
Hi ArneRademacker,
Great to hear you're working on this app project - I'm sure we'll be able to figure out the best process for receiving reliable notifications about the status changes of orders. I'll answer the questions below.
Matching Event API responses with Webhook API responses: The Event API responses and Webhook API responses do contain IDs that can be compared. The Event API provides a stream of events, and the Webhook API delivers notifications based on those events. By comparing the IDs of the events received via the Event API with the data received through webhooks, you can determine if you have already processed a particular event and avoid duplicating the work.
Querying for webhook events that were not delivered or did not return a 200: Currently, Shopify does not provide a built-in way to query for webhook events that were not successfully delivered or did not return a 200 status. Shopify assumes responsibility for delivering webhooks, and in most cases, retries failed deliveries automatically. If you require more robust delivery monitoring or missed event detection, you would need to build custom logic to track the delivery status of webhooks and handle missed events accordingly.
Recommended strategy for webhook reconciliation: Implementing a reconciliation function at a regular interval is a common strategy to complement webhooks. This function would query the necessary resources, such as orders, and compare them with the data received through webhooks. The purpose of webhooks is to provide real-time event notifications, but a reconciliation process helps ensure data integrity and handles any missed events or discrepancies that may occur due to the asynchronous nature of webhooks.
Receiving updates to individual fields of a resource: Shopify's API does not provide a direct way to receive updates for specific fields of a resource. The recommended approach is to query for the entire resource and filter the results based on the desired field changes or date ranges. While updated_at
is discouraged due to frequent updates, you can still utilize it along with other filters to narrow down the results.
Considering the trade-offs and complexities involved in reconciling webhooks, it's important to weigh the benefits against the overhead of managing the reconciliation process. If you find that the reconciliation function at regular intervals meets your requirements and offers a simpler implementation, it might be a better alternative to relying solely on webhooks.
Hope this helps!
Liam | Developer Advocate @ 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
This is an accepted solution.
Hi ArneRademacker,
Great to hear you're working on this app project - I'm sure we'll be able to figure out the best process for receiving reliable notifications about the status changes of orders. I'll answer the questions below.
Matching Event API responses with Webhook API responses: The Event API responses and Webhook API responses do contain IDs that can be compared. The Event API provides a stream of events, and the Webhook API delivers notifications based on those events. By comparing the IDs of the events received via the Event API with the data received through webhooks, you can determine if you have already processed a particular event and avoid duplicating the work.
Querying for webhook events that were not delivered or did not return a 200: Currently, Shopify does not provide a built-in way to query for webhook events that were not successfully delivered or did not return a 200 status. Shopify assumes responsibility for delivering webhooks, and in most cases, retries failed deliveries automatically. If you require more robust delivery monitoring or missed event detection, you would need to build custom logic to track the delivery status of webhooks and handle missed events accordingly.
Recommended strategy for webhook reconciliation: Implementing a reconciliation function at a regular interval is a common strategy to complement webhooks. This function would query the necessary resources, such as orders, and compare them with the data received through webhooks. The purpose of webhooks is to provide real-time event notifications, but a reconciliation process helps ensure data integrity and handles any missed events or discrepancies that may occur due to the asynchronous nature of webhooks.
Receiving updates to individual fields of a resource: Shopify's API does not provide a direct way to receive updates for specific fields of a resource. The recommended approach is to query for the entire resource and filter the results based on the desired field changes or date ranges. While updated_at
is discouraged due to frequent updates, you can still utilize it along with other filters to narrow down the results.
Considering the trade-offs and complexities involved in reconciling webhooks, it's important to weigh the benefits against the overhead of managing the reconciliation process. If you find that the reconciliation function at regular intervals meets your requirements and offers a simpler implementation, it might be a better alternative to relying solely on webhooks.
Hope this helps!
Liam | Developer Advocate @ 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
Hi Liam,
Thank you for your swift response!
Your answers are very helpful, I will add them to our infrastructure planning 🙂
As this does a good job of answering what I asked, I will mark it as accepted, even though I didn't present a singular problem.
Cheers!