Blog
Webhooks in Shopify App Development: Complete Guide

Key Takeaways
- Webhooks let Shopify proactively push real-time event notifications to your app instead of your app constantly polling the API for changes.
- A webhook is an automated HTTP POST request Shopify sends to your endpoint URL, containing a JSON payload about a specific event.
- Webhooks improve efficiency, scalability, and performance by eliminating countless polling API calls and helping you stay within Shopify's rate limits.
- You subscribe to topics like orders/create or products/update, with the three privacy compliance topics mandatory for every App Store app and app/uninstalled essential for cleanup.
- Declaring app-specific subscriptions in your shopify.app.toml configuration file is the method Shopify recommends, with the GraphQL Admin API reserved for shop-specific subscriptions.
In the dynamic world of e-commerce, real-time data is not a luxury; it's a necessity. For a Shopify app to be truly powerful and responsive, it needs to know what’s happening in a merchant's store the moment it occurs. Did a customer just place an order? Has a product's inventory level changed? Was a customer's record just updated? Polling the Shopify API every few minutes to check for these changes is inefficient, slow, and a waste of resources. This is where webhooks come in.
Webhooks are the central nervous system of a modern Shopify app. They are the mechanism that allows Shopify to proactively send real-time notifications to your application whenever a specific event occurs in a store. Instead of your app constantly asking "Anything new?", Shopify tells your app, "Hey, something just happened." Mastering webhooks is essential for building sophisticated, efficient, and event-driven applications that provide immediate value to merchants. This guide will provide a comprehensive overview of webhooks, explaining what they are, why they're critical, and how to implement them securely and reliably in your Shopify app.
What Exactly Are Webhooks?
A webhook is an automated message sent from one application to another when a specific event takes place. They are sometimes called "reverse APIs" or "HTTP push notifications." While a standard API call involves your application actively requesting data from a server, a webhook reverses this flow. You tell the source application (Shopify) what events you're interested in and provide a URL endpoint. When one of those events happens, Shopify automatically sends an HTTP POST request containing a payload of data about that event to your specified URL.
For example, you can subscribe to the orders/create webhook topic. Every time a new order is placed in a store that has your app installed, Shopify will instantly send a JSON object with all the details of that new order to your app's designated webhook receiver endpoint. This allows your app to react immediately, whether that means sending the order to a fulfillment service, updating an internal dashboard, or triggering a custom email notification.
Why Webhooks are Essential for Shopify Apps
Relying on webhooks instead of constant API polling provides several significant advantages:
- Real-Time Responsiveness: Your app can act on events the instant they happen. This is crucial for use cases like fraud detection, inventory synchronization, and time-sensitive customer communications.
- Efficiency and Performance: Webhooks eliminate the need for your app to make countless API calls just to check for updates. This dramatically reduces the load on both your server and Shopify's, leading to a more performant and scalable system. It also helps you stay well within your API rate limits.
- Scalability: A webhook-based architecture is inherently more scalable. As a store's activity grows, your app simply handles more incoming notifications. A polling-based system, by contrast, becomes increasingly slow and inefficient as data volume increases.
- Enables Complex Workflows: Many advanced app features are only possible through webhooks. Automating multi-step fulfillment processes, syncing data across multiple platforms, or providing real-time analytics all depend on receiving immediate event notifications.
Building a modern e-commerce solution requires this kind of event-driven architecture. It's a core principle in professional app design and development and a key differentiator between a basic app and a truly powerful one.
How to Implement Webhooks in a Shopify App
Setting up webhooks involves two main parts: subscribing to the webhook topics you need and creating a secure endpoint in your application to receive and process the notifications.
Subscribing to Webhook Topics
A "topic" is the specific event you want to be notified about. Shopify offers a vast list of webhook topics covering almost every aspect of a store, including:
- Orders: orders/create, orders/paid, orders/fulfilled, orders/cancelled
- Products: products/create, products/update, products/delete
- Customers: customers/create, customers/update
- Carts: carts/create, carts/update
- Fulfillment: fulfillments/create, fulfillments/update
- App Status: app/uninstalled (essential for cleanup)
- Privacy compliance: customers/data_request, customers/redact, shop/redact (mandatory for App Store apps)
You can subscribe to these topics in a few ways:
- Using the app configuration file (the recommended method): Shopify recommends app-specific subscriptions, which you declare once in your app's shopify.app.toml file and deploy with the Shopify CLI. You specify the topic and the endpoint URL, and the subscription applies to every store that installs your app, so there is nothing to set up manually per store.
- Using the GraphQL Admin API (for shop-specific needs): If a subscription must differ from store to store, you can create it programmatically using the Shopify API (the GraphQL Admin API's webhookSubscriptionCreate mutation) after the app is installed and you have an access token for the store.
In shopify.app.toml, an app-specific subscription looks like this:
[webhooks]
api_version = "2026-10"
[[webhooks.subscriptions]]
topics = ["orders/create"]
uri = "https://yourapp.com/webhooks/orders_create"
This configuration tells Shopify, "For every store that installs this app, whenever a new order is created, send the order data as a JSON payload to https://yourapp.com/webhooks/orders_create." Add every topic your app needs to function. If you also use shop-specific subscriptions, it's a good practice to have a process that periodically verifies that the required webhook subscriptions are still active for each store.
Building a Secure and Reliable Webhook Endpoint
Creating the endpoint in your application that receives these notifications is the most critical part of the process. This endpoint must be designed to be highly secure, reliable, and fast.
Security First: Verifying Webhook Authenticity
The most important step you must take when receiving a webhook is to verify that it actually came from Shopify. Since your webhook URL is public, a malicious actor could send fake data to it to try to corrupt your system or trigger unwanted actions. Shopify solves this by including a unique signature in the headers of every webhook request.
The header you need to check is X-Shopify-Hmac-Sha256. This value is a Base64-encoded HMAC-SHA256 signature. To verify it:
- Read the entire raw body of the HTTP POST request. It is crucial that you use the raw body, not a parsed version, as even a small change will invalidate the signature.
- Using your app's client secret (found in your app's settings in the Dev Dashboard), compute the HMAC-SHA256 hash of the raw request body.
- Base64-encode the hash you just computed.
- Compare your encoded hash to the value of the X-Shopify-Hmac-Sha256 header.
- If they match, the webhook is authentic. If they do not match, you must immediately discard the request and return an error. Do not process unverified webhooks.
Almost all server-side frameworks and languages have libraries that make HMAC computation straightforward. Implementing this verification is non-negotiable for any production app.
Best Practice: Acknowledge Immediately, Process Asynchronously
A common mistake is to perform lengthy processing tasks directly within the webhook receiver endpoint. Shopify expects a response to its webhook request within a few seconds. If your endpoint takes too long to respond (e.g., because it's trying to call another API, generate a report, or send an email), Shopify will consider the delivery a failure and will try to send the webhook again. This can lead to duplicate processing and other unintended consequences.
The best practice is to design your webhook endpoint to do two things, and two things only:
- Verify the HMAC signature to ensure the request is authentic.
- Enqueue the payload into a background job queue for later processing.
Once the payload is safely enqueued, your endpoint should immediately return a 200 OK status code to Shopify. This tells Shopify, "Thank you, I've received the message and will take care of it." The actual work—the business logic of your app—is then handled by a separate background worker process.
This asynchronous architecture offers several key benefits:
- Speed: Your endpoint responds almost instantly, preventing timeouts.
- Reliability: If your background worker fails to process a job, it can be retried automatically without affecting the receipt of new webhooks. Job queues provide built-in mechanisms for retries and error handling.
- Scalability: You can scale your web servers and background workers independently. If you start receiving a high volume of webhooks, you can simply add more background workers to process the queue without slowing down your main application.
Tools like Sidekiq (for Ruby), BullMQ (for Node.js), or Celery (for Python) are excellent for managing background job queues. This architectural pattern is a cornerstone of modern software design and development.
Get a FREE Audit
We'll perform a comprehensive SEO, AEO, GEO & CRO audit of your website — completely free — and show you exactly how to outrank your competitors.
Don't have a site yet? Get in touch →
Common Use Cases for Webhooks in Shopify Apps
The possibilities with webhooks are nearly endless. Here are some common and powerful use cases that demonstrate their value:
- Inventory Synchronization: Subscribe to products/update and inventory_levels/update. When a product's stock level changes on Shopify, your app can instantly update the inventory in an external ERP, warehouse management system, or another sales channel like Amazon or eBay.
- Automated Order Fulfillment: Use the orders/create or orders/paid webhook to automatically send new order details to a third-party logistics (3PL) provider or a dropshipping supplier for fulfillment. When the 3PL ships the order, they can call an endpoint in your app, which then uses the Shopify API to mark the order as fulfilled and add tracking information.
- Customer Relationship Management (CRM) Integration: Use customers/create and customers/update to keep customer data in sync with a CRM like Salesforce or HubSpot. Use orders/create to log new purchases against a customer's record in the CRM.
- Custom Notifications: Send customized email or SMS notifications that go beyond Shopify's default options. For example, trigger a special "welcome" sequence from your marketing automation platform when a new customer makes their first purchase.
- Analytics and Reporting: Push real-time data about orders, customers, and products into a data warehouse or business intelligence tool to create live dashboards and reports.
- Compliance and Logging: For legal or accounting purposes, use webhooks like orders/create and orders/paid to create an immutable log of all transactions in a separate, secure system.
Handling Failures and Ensuring Reliability
Even with a perfect setup, things can go wrong. Network issues, server downtime, or bugs in your code can cause webhook processing to fail. A robust system must be prepared for this.
- Shopify's Retry Mechanism: As mentioned, if Shopify doesn't receive a 200 OK response from your endpoint, it will retry sending the webhook up to eight times over a four-hour period with an increasing delay between attempts. This provides a built-in buffer for temporary outages.
- Idempotency: Because of retries (from Shopify or your own job queue), your webhook processing logic must be idempotent. This means that processing the same webhook multiple times has the same effect as processing it once. For example, if you receive an orders/create webhook, your code should first check if you have already processed an order with that specific order_id. If you have, you can safely ignore the duplicate webhook.
- Monitoring and Alerting: You need a system to monitor your webhook endpoints and background job queues. Set up alerts that notify you if your endpoint starts returning non-200 status codes or if your job queue has a large number of failed jobs. Tools like Datadog, New Relic, or Sentry can provide this visibility.
- The app/uninstalled Webhook: This is one of the most important webhooks to handle (the mandatory ones for App Store apps are the three privacy compliance topics: customers/data_request, customers/redact and shop/redact). When a merchant uninstalls your app, Shopify sends this webhook to your designated endpoint. Your app must listen for this event, verify it, and then perform cleanup tasks, most importantly deleting the store's access token and any stored personal data to comply with privacy regulations.
A strong on-page presence for your app's marketing site is also part of a holistic strategy. Ensuring your site content is well-structured and optimized can improve visibility through SEO, helping merchants discover the reliable and powerful solution you've built.
Conclusion: Build Reactive, Not Active, Applications
Webhooks are the key to shifting your app's architecture from an active, polling-based model to a reactive, event-driven one. By leveraging webhooks, you can build applications that are faster, more efficient, more scalable, and capable of delivering the real-time functionality that merchants expect.
The core principles of a successful webhook strategy are clear: subscribe to the topics you need, secure your endpoint by verifying every request, and process all business logic asynchronously in a background job queue. By adhering to these best practices and designing your system to be idempotent and resilient, you can build a reliable foundation for any Shopify app, no matter how complex.
Embracing this event-driven approach is a mark of sophisticated app development. If you are looking to build a Shopify app that leverages the full power of webhooks or need help optimizing an existing application, contact eSEOspace. Our team has deep expertise in architecting and building robust, scalable Shopify solutions that drive business growth.
Frequently Asked Questions
What exactly is a webhook in Shopify app development?
Why should I use webhooks instead of polling the Shopify API?
What are webhook topics and which ones can I subscribe to?
What is the recommended way to subscribe to webhooks?
What kinds of features do webhooks enable in a Shopify app?
Put this into action with eSEOspace
We help businesses grow with website development that actually performs. Explore the services behind this guide:
Get a FREE GEO/AEO/SEO Audit
We'll analyze your site's SEO, GEO, AEO & CRO — completely free — and show you exactly how to get found across Google and AI answers.
Don't have a site yet? Get in touch →
Great — your audit is on the way!
We'll send your free SEO/GEO/AEO/CRO audit within the next few hours. Where should we send it?
You're all set! ✓
Your free audit is being prepared — check your inbox in the next few hours. Talk soon!
On this page





