Skip to main content

Best practices for webhooks

The following guide describes some best practices for working with webhooks.


In rare circumstances, you might experience delays receiving webhooks. If receiving webhooks up to a day late might cause issues in your app, then we recommend comparing the timestamp of the webhook to the current date and time.


Anchor to Recover from a downtime eventRecover from a downtime event

If your app goes offline for an extended period of time, then you can recover by re-subscribing to your webhook topics (if applicable) and importing the missing data.

You don't need to re-subscribe if your app uses app-specific webhook subscriptions. For shop-specific webhook subscriptions, consult the app's code that initially created the subscriptions. You can add a check that fetches all the existing subscriptions and creates only the ones that you need.

To import the missing data, you can fetch data from the outage period and feed it into your webhook processing code.


When you use the includeFields argument in GraphQL to specify which fields should be sent by a webhook, you must include a field that always has a unique value. For example, you can include the updated_at field in the includeFields argument.

Including a field that always has a unique value prevents the webhook from being dropped as a duplicate, such as in cases when only the id field is requested.


Anchor to Build idempotent webhooks processingBuild idempotent webhooks processing

Shopify's webhook system minimizes sending duplicate webhooks to subscribers. However, they might receive the same webhook more than once.

If your webhook processing isn't idempotent, you can follow our guidelines for ignoring duplicate webhooks.


Anchor to Implement reconciliation jobsImplement reconciliation jobs

Your app shouldn't rely solely on receiving data from Shopify webhooks. Because webhook delivery isn't always guaranteed, you should implement reconciliation jobs to periodically fetch data from Shopify.

You could do this in the background, or offer reconciliation and syncing options to the merchant. For example the UI of your app could contain a button that triggers a manual reconciliation process by calling the relevant API endpoint, and fetching the requested data.

Many GraphQL queries support updated_at filter parameters. These filters can be used to build a job that fetches all objects that have been updated since the last time the job ran.


Anchor to Build a scalable and reliable systemBuild a scalable and reliable system

Tracking traffic from Shopify's platform can be overwhelming, especially as you grow your app.

If you need to manage large volumes of event notifications to build a scalable and reliable system, then you can configure subscriptions to send webhooks using Amazon EventBridge or Google Cloud Pub/Sub rather than using HTTPS.



Was this page helpful?