SmartBrain

Shopify Webhooks and Real-Time DM Automation: Staying in Sync with Live Inventory Changes

2026-07-02 · Shopify webhooks, DM automation, real-time inventory, conversational commerce, ManyChat Shopify integration

What Are Shopify Webhooks and Why Do They Matter for DM Automation?

A Shopify webhook is an HTTP callback that Shopify sends to an external URL the instant a specific event occurs in your store — a product sells out, a variant goes back in stock, a price changes. Instead of your automation layer asking Shopify "what changed?" every few minutes, Shopify tells your system the moment something happens.

For DM automation — chatbots running on Instagram, WhatsApp, Facebook Messenger, or SMS — that difference is critical. A shopper who asks "do you have this in size M?" at 9:03 PM deserves an accurate answer, not a cached one from 8:45 PM when you still had three units left.

Which Shopify Webhook Topics Should DM Automations Listen To?

Shopify exposes dozens of webhook topics. For inventory-aware DM automation, these are the ones that matter most:

Subscribing to only the topics you need reduces noise and keeps your system processing only relevant events.

How Does the Real-Time Sync Flow Actually Work?

The architecture has three moving parts: the Shopify store, a middleware endpoint that receives webhooks, and the DM automation platform that handles the conversation.

Here is a concrete example. A DTC skincare brand runs a ManyChat flow on Instagram. A shopper sends "is the vitamin C serum still in stock?" At that moment, the flow queries the brand's middleware. The middleware holds a local inventory snapshot that was last updated by a Shopify webhook 40 seconds ago when another customer completed checkout. The answer is accurate and instant — no API call to Shopify needed at query time.

The key insight: DM conversations happen at human conversational speed (fractions of a second). Direct Shopify Admin API calls at that moment introduce latency and hit rate limits. A webhook-fed local snapshot solves both problems.

Polling vs. Webhooks: Why the Difference Is Not Trivial

Some automation setups poll the Shopify Admin API on a schedule — every 5 or 15 minutes — to refresh inventory data. This creates a window where your chatbot can confidently recommend a product that sold out 4 minutes ago.

Webhooks eliminate that window. The table below shows the practical difference:

For stores moving fewer than 50 orders per day, polling is often acceptable. For anything above that threshold — especially during flash sales, drops, or influencer campaigns — webhooks are the correct architecture.

What SmartBrain Does Differently with Inventory Sync

Most DM automation tools hand off product selection to the AI or to static keyword rules. SmartBrain inverts this: the server-side engine decides which product to recommend based on real-time catalog state — in-stock, on budget, matching the shopper's stated needs — and the AI only writes the conversational copy around that decision.

This means SmartBrain's recommendation layer subscribes to inventory webhooks continuously. When a variant goes to zero, it drops out of the candidate pool instantly. The AI never has the chance to hallucinate a recommendation for a product that cannot ship. For agencies managing multiple Shopify stores, SmartBrain maintains a separate webhook subscription per store, so inventory events from one client never bleed into another's conversation context.

Common Implementation Pitfalls and How to Avoid Them

Webhook Delivery Is Not Guaranteed

Shopify retries failed webhook deliveries up to 19 times over 48 hours, but your endpoint must return a 2xx HTTP response within 5 seconds or the delivery is marked failed. Process the event asynchronously: write the raw payload to a queue immediately, return 200, then handle inventory updates in a background worker.

Out-of-Order Delivery

Webhooks can arrive out of sequence, especially during high-volume periods. Always compare the updated_at timestamp in the payload against your stored record before overwriting. Ignore events older than your current snapshot.

HMAC Verification

Every Shopify webhook includes an X-Shopify-Hmac-Sha256 header. Verify it against your webhook secret before processing the payload. Skipping this step opens your endpoint to spoofed inventory events.

Multi-Location Inventory

If your store fulfills from multiple locations, inventory_levels/update fires per location. Your sync layer needs to aggregate across all locations — or filter to the locations that actually fulfill DM-driven orders — before deciding whether a product is "in stock" for recommendation purposes.

Practical Checklist for DM Automation Teams

Agencies using SmartBrain can skip most of this infrastructure work — the platform handles webhook registration, queue management, and hourly reconciliation natively, so the integration surface for a new Shopify store is a single OAuth connection.

FAQ

Can I use Shopify webhooks with ManyChat directly?

ManyChat does not natively receive Shopify webhooks. You need middleware — a small server or a platform like SmartBrain — that listens for webhook events, updates an inventory layer, and exposes that data to ManyChat via Custom Actions or Dynamic Blocks.

How quickly does a webhook fire after an inventory change?

Shopify typically delivers inventory webhooks within 1–3 seconds of the triggering event under normal load. During flash sales or peak traffic, delivery can lag to 10–30 seconds. This is still far faster than a 5-minute polling interval.

Do webhooks work with Shopify Markets and multi-currency stores?

Yes. Inventory-level webhooks are location-based, not currency-based. Multi-currency and Markets configuration affects pricing display, not stock event delivery.

What happens if my endpoint is down and I miss a webhook?

Shopify retries for 48 hours. If your endpoint recovers within that window, you will receive the event. For longer outages, rely on your hourly reconciliation job to restore consistency.

Is there a limit on the number of webhook subscriptions per store?

Shopify allows up to 10 webhook subscriptions per topic per store. In practice, a single well-architected middleware endpoint receiving all relevant topics is sufficient for most DM automation setups.

Try SmartBrain free on your store — watch it qualify a shopper and recommend the exact in-stock product, in minutes. Free plan, instant setup, no rebuild.

Start free →