Skip to main content

Shopify Webhooks Review

Shopify is an amazing product that lets entrepreneurs set up an online store. They have a very well documented API with a webhook feature so we took a look to see how they’ve designed their webhook offering and how they’ve documented it.

When we look at webhook solutions, we’re generally looking for 7 things: signature verification, retries, manual retries, exponential backoff, visibility/logs, event types, and multiple endpoint support. For signature verification, our reference point is the Standard Webhooks specification, which defines the standard headers and signing scheme.

TL;DR:
✅ Signature Verification
✅ Retries
✅ Exponential Backoff
⬜ Manual Retries
✅ Visibility into Logs
✅ Event Types
✅ Multiple Endpoints Support

To start, their documentation looks great! Kudos to the designer.

shopify webhook docs

They’ve also separated the API endpoint reference from their webhook overview/configuration information which is very common. They’ve also done a good job linking between them to make sure people can find the information they’re looking for.

We also liked that they listed the limitations of their webhook offerings up front:

shopify webhook limitations

One thing we found a bit harsh was their webhook timeout (the default time window after which they consider your webhook to have failed) is only 5 seconds. We’ve seen most timeouts be ~10 seconds but have seen some up to 30 seconds. Longer is not necessarily better but 5s is probably too short.

Signature Verification ✅​

Signature Verification is a critical security feature of webhooks. It lets users verify that a webhook was actually sent from the expected source.

Each HTTPS delivery from Shopify includes a base64-encoded HMAC-SHA256 signature in the X-Shopify-Hmac-SHA256 header, generated from the raw request body with your app’s client secret (docs). That lets their users verify that the webhook was sent from Shopify.

Shopify webhook headers table listing X-Shopify-Hmac-Sha256, X-Shopify-Webhook-Id, and X-Shopify-Shop-Domain

Retries ✅​

Webhook messages fail all the time for various reasons. Without retries, your users are going to be missing a lot of notifications which is a terrible user experience.

Shopify retries a failed delivery 8 times over the next 4 hours. Any response outside the 200 range counts as a failure, including a 3xx. After 8 consecutive failures, a subscription that was created through the Admin API is automatically deleted, and warning emails go to the app’s emergency developer email address. Subscriptions defined in the app’s configuration file are not deleted.

When we first reviewed Shopify in 2022, its docs listed 19 retries over 48 hours, so the window is much shorter now. Four hours is not a lot of time to notice a broken endpoint and fix it.

Looking to send webhooks at scale?

Schedule a Call

Exponential Backoff ✅​

Exponential backoff is an algorithm that increases the delay between retries exponentially. This ensures that your system won’t get bottleneck from having to re-queue failed webhooks while also giving users time to fix broken endpoints before they burn through all their retry attempts.

It’s not explicitly stated that their retry schedule follows an exponential backoff algorithm, and the intervals themselves aren’t published. The docs do say that the interval before the next retry increases each time a delivery fails, which is the important part. We would recommend publishing the schedule in the description of retries.

Shopify documentation on troubleshooting failed deliveries, stating that the time between retried deliveries increases each time a delivery fails

Manual Retries​

In the event that a user’s endpoint is failing, its nice to give the developer tasked with debugging the endpoint, the option to initiate a retry manually instead of having to wait for the next scheduled retry (this could be several hours of waiting if they’re close to the end of the retry schedule).

We could not find any mention of resending a failed delivery manually. The Shopify CLI has a webhook trigger command, but it sends a test delivery, not a replay. For events missed during downtime, the docs suggest re-subscribing to your topics and importing the missing data.

Visibility into Logs ✅​

Giving users visibility into the delivery logs is critical for troubleshooting/debugging. Shopify’s docs are very detailed in explaining various troubleshooting strategies. In the Dev Dashboard, your app’s Logs page shows individual deliveries over the past 7 days, filterable by topic, status, and destination shop, and the Overview page shows delivery counts and response time. The logs aren’t real time: data can be delayed by up to several minutes.

Shopify documentation table for identifying failed deliveries: failed delivery rates over 0.5%, removed webhooks, response times between four and five seconds, and the same failure rate across all topics

Event Types ✅​

Event types are identifiers denoting the type of message being sent and are the primary way for webhook consumers to configure what events they are interested in receiving.

Shopify calls its event types topics, and lists them all in its webhooks reference. As of the 2024-07 API version, a subscription can also carry a filter that suppresses deliveries whose payload doesn’t match.

Multiple Endpoint Support ✅​

Many webhook solutions only allow one endpoint URL to be specified where all messages will be received. By enabling your users to create multiple endpoints, they’ll be able to choose which endpoints receive which messages. Multiple endpoint support and event types go hand in hand.

Shopify lets you create multiple subscriptions, each naming one or more topics and a destination, which can be an HTTPS URL, an Amazon EventBridge ARN, or a Google Pub/Sub URI. If you have more than one subscription for the same topic, you get a separate delivery per subscription.

Summary​

Overall, Shopify’s webhook docs are very thorough and they offer a lot of the features that contribute to an excellent developer experience. Our improvements to suggest would be to add manual retries, publish the retry schedule, stretch the retry window back out past 4 hours, and expand the timeout window to 10 seconds.

If you’re looking to implement webhooks at Shopify’s level, consider trying Svix, our webhooks as a service product that makes it super easy to build a secure, reliable, and scalable webhook solution through an API.