E-commerce

How to connect an AI chatbot to Shopify webhooks to respond to the right event?

How to connect an AI chatbot to Shopify webhooks to respond to the right event?

June 28, 2026

The customer opens the chat: "Where is my order?" The bot queries the Shopify API, finds the status, and replies in 8 seconds. Perfect. But 40% of these questions could have disappeared if the bot had known, from the moment of shipment, that the parcel was leaving and had pre-filled the conversational context.

Shopify webhooks push an event (order created, parcel shipped, refund) to your endpoint as soon as it occurs (Shopify, webhooks apps). ShippyPro estimates that proactive notifications related to logistical events reduce WISMO tickets by 50 to 65% (ShippyPro, WISMO 2026).

This guide #217 shows how to connect an AI chatbot to Shopify webhooks to trigger the right response at the right time. Distinct from the webhook glossary (definition) and order tracking (#184) (reactive WISMO response): here, push event-driven automation, not just lookup pull.

Summary

Why does an event chatbot beat a purely reactive bot?

A Shopify event-driven chatbot listens to store changes and updates the conversational context before the customer even asks the question.

Push vs pull

  • Pull: the customer asks, the bot calls the order API

  • Push: Shopify sends a webhook, the bot enriches the profile + proactive message

Three measurable gains

  • Less WISMO: shipping context is already known at the time of the chat

  • Shorter response times: no API lookup on every message

  • Widget proactivity: "Your package is on its way" bubble if the session is open

DTC accessories example

Store with 800 orders/month, WISMO pull-only bot: 310 tickets/month tracking intent. Adding webhooks fulfillments/create + fulfillment_events/create → client context cache + proactive message on the account page. WISMO tickets −44% in 6 weeks, bot response times −60% (no more cold lookups).

How does it differ from the webhook glossary and order tracking #184?

Five neighboring pieces of content, five roles. #217 connects Shopify events to the bot engine.

Webhook Glossary

Webhook Glossary: technical HTTP POST definition. #217: which topics to subscribe to and which bot action to trigger.

Order tracking (#184)

Order tracking (#184): WISMO branches when the customer writes. #217 feeds these branches before the question.

Support by status

Customize by status: macros and scripts per phase. #217 automates phase detection via webhook.

Internal alerts (#172)

Internal alerts (#172): Slack ops from conversations. #217 targets the customer, not the internal team.

Shopify data training

Train Shopify bot: catalog and policies. #217 adds the real-time order flow.

Promise #217

Priority topics, receiver architecture, event → message mapping, security, KPIs, playbooks.

Which Shopify webhooks should be subscribed to first for the bot?

Do not subscribe to the 200 Shopify topics. Prioritize e-commerce chatbot webhooks by ticket impact.

Tier 1: post-purchase (immediate ROI)

  • orders/create: order paid, fresh purchase context

  • fulfillments/create: shipment, tracking number

  • fulfillment_events/create: in transit, out for delivery, delivered

  • orders/updated: status change, address change, cancellation

Tier 2: Customer Service and exceptions

  • refunds/create: refund initiated, reassure customer

  • returns/request: return initiated, guide through steps

  • orders/cancelled: cancellation, explain next steps

Tier 3: pre-purchase and catalog

  • checkouts/update: abandoned cart identified (see bot before abandonment email)

  • inventory_levels/update: out of stock on recently viewed SKU

  • products/update: price or availability change on session page

Required API Scopes

Shopify requires read_orders, read_fulfillments, read_customers depending on the topics (Shopify, webhook topics). Request the minimum: read-only, no write from the webhook receiver.

How to architect the webhook flow to the bot engine?

The standard chatbot webhook architecture consists of 5 components.

1. HTTPS Endpoint

Public POST URL (e.g., /webhooks/shopify). Responds with 200 in less than 5 s. Heavy processing is handled in an async queue (Redis, SQS, or Qstomy worker).

2. HMAC Verification

Compare the X-Shopify-Hmac-SHA256 header with the HMAC of the raw body + app secret. Reject any unsigned payload. Shopify documents mandatory constant-time verification.

3. Deduplication

X-Shopify-Webhook-Id header: store processed IDs for 48 hours. Shopify does not guarantee the order of webhooks on the same resource: the latest payload = truth.

4. Event Normalizer

Transforms the Shopify payload into an internal object: {customer_id, order_id, event_type, status, tracking, sku[]}. Decouples the bot from the raw Shopify format.

5. Bot Engine / Context Store

Updates the customer's conversational profile. If the widget is open or the session is recent (< 30 min), triggers a proactive message. Otherwise, enriches the next pull interaction.

Flow Diagram

Shopify event → POST endpoint → HMAC OK → queue → normalizer → context store → bot rule engine → (proactive widget OR cache for pull). Klaviyo email remains parallel, not replaced.

Which event → bot action → message mapping should be applied?

Webhook → bot action mapping table ready to implement.

orders/create

Action: link order_id to the chat customer profile. Proactive message (if customer account widget): "Order #[X] confirmed. Preparation within [policy delay]. Ask your questions here." Pull enrichment: bot knows the last order without asking for email.

fulfillments/create

Action: inject tracking + carrier. Proactive: "Good news: order #[X] shipped via [carrier]. Tracking: [link]. Estimated delivery [date]." Aligned with branches #184.

fulfillment_events/create (out_for_delivery)

Proactive SMS or widget: "Your package is arriving today. Tracking: [link]." ShippyPro: out for delivery notification reduces missed deliveries by up to 35%.

fulfillment_events/create (delivered)

Action: switch default intent to return/product support. Proactive: "Package delivered. Any issues? Describe them here." No aggressive review requests.

refunds/create

Action: refund amount context + bank processing time. Pull: if customer writes "where is my refund", immediate response without escalation.

checkouts/update (abandoned)

Action: if checkout idle 10 min + email known + cart SKU, trigger widget: "Question about [product] or shipping costs?" See cart recovery (#47).

inventory_levels/update (stock 0)

Action: if customer has viewed this SKU in session 24 hours, proactive: "[Product] has just run out of stock. Alternatives: [links]."

When to use webhook push vs API pull?

The webhook does not replace the API. Clear push vs pull chatbot rules.

Use the webhook (push)

  • Proactive notification to the customer

  • Context cache update between two messages

  • Bot rule triggering without polling

Use the pull API (get order)

  • Customer asks WISMO without a recently received webhook

  • Reconciliation after endpoint failure (missed webhook)

  • Lookup of old orders (> 30 days) out of cache

Polling anti-pattern

Do not schedule a cron "query Shopify every 5 min per active customer". API cost, latency, rate limits. Webhooks + pull-on-demand are sufficient.

Propagation delay

After checkout, wait 10 seconds before the first lookup if the orders/create webhook has not arrived yet. Fallback message: "I am finalizing the retrieval of your order..."

What are the production rules before going live?

Six chatbot webhook production rules before go-live.

Rule 1: immediate 2xx response

Shopify retries up to 8 times over 4 hours if a failure occurs. Process asynchronously, not in the HTTP handler.

Rule 2: raw body for HMAC

Do not parse JSON before signature verification. Classic error: Express middleware parsing too early.

Rule 3: idempotency

Same webhook received 2× = 1 bot action. Key: webhook_id + order_id + event_type.

Rule 4: last state wins

orders/updated can arrive before fulfillments/create. Store the Shopify timestamp, ignore older events.

Rule 5: filter by shop

Header X-Shopify-Shop-Domain: route multi-store if applicable.

Rule 6: logs without full PII

Log order_id, event_type, latency. Mask address and email in production logs.

Sandbox testing

Shopify CLI shopify app dev or "Send test webhook" button in the Partner Dashboard. 15 scenarios: create, fulfill, deliver, refund, cancel, duplicate delivery.

Which lifecycle scenarios should be implemented first?

Three lifecycle scenarios where webhooks + bot beat email alone.

Scenario A: D+1 shipping

Webhook fulfillments/create 9:00 AM. Customer opens site at 9:15 AM, widget displays shipped status. They do not open a ticket. Klaviyo email is sent in parallel at 9:05 AM.

Scenario B: carrier delay

Tracking app (AfterShip) detects delay → custom webhook or orders/updated + delay tag. Proactive bot: "1 day delay, new delivery on Friday. No action required." Claimlane: proactive delay alert avoids a €5+ ticket per contact.

Scenario C: refund in progress

Customer writes "refund?" 2 savings after refunds/create. Bot reads cache: "Refund of €49.90 initiated on [date], visible in 5-10 business days at your bank." 100% FCR.

Multichannel orchestration

Webhook feeds bot + Gorgias helpdesk sidebar + Klaviyo segment. The bot does not duplicate the transactional email: it responds in chat and enriches the agent context if escalated. See human context transfer.

Which KPIs measure the impact of webhooks on the bot?

Measure the chatbot webhooks impact vs bot pull alone.

Comparative KPIs

  • WISMO tickets / 1000 orders: baseline vs post-webhooks

  • WISMO bot response latency: ms with cache vs without

  • Proactive message open rate: widget click post-webhook

  • FCR intent tracking: resolved without recontact

  • Webhooks failed / retried: endpoint health

4-Week A/B Test

Weeks 1-2: bot pull only. Weeks 3-4: active Tier 1 webhooks. Same traffic, same transactional emails. Expected DTC mid-size: WISMO −30% to 45%, bot latency −50% on post-purchase intents.

Dashboard

Tiles for "events processed / h", "cache hit rate pull", "proactives sent". See Shopify support dashboard (#216).

What mistakes should be avoided with chatbot webhooks?

Five common chatbot webhook errors in production.

Error 1: synchronous processing

Shopify timeout, infinite retries, duplicates. Fix: async queue section 4.

Error 2: proactive spam

5 widget messages per order. Fix: max 1 proactive / phase (ship, deliver), cap 2/day.

Error 3: ignoring consent

Proactive checkout without marketing opt-in. Fix: proactive support ≠ promo, no hard selling.

Error 4: webhook without fallback pull branch

Endpoint down for 2 hours, blind bot. Fix: API pull if cache stale > 15 min.

Error 5: confusing webhook and email

Disabling Shopify emails thinking the bot is enough. Fix: complementary channels, bot for instant chat, email for asynchronous record.

How does Qstomy consume Shopify webhooks?

Qstomy consumes native Shopify webhooks without any custom endpoint on the merchant side.

Connected Qstomy Events

  • orders/create, orders/updated: sidebar order context + bot

  • fulfillments/create + events: pre-loaded WISMO flows

  • refunds/create: instant refund intent

  • checkouts/update: configurable abandoned cart trigger

Quantified DTC Scenario

Wellness brand, 1,200 orders/month, bot pull WISMO only, 38% tracking intent tickets. Activation of Qstomy Tier 1 webhooks + account widget proactive messages. After 7 weeks: WISMO tickets −41%, tracking response latency 1.2 s → 0.3 s, tracking intent FCR +18 pts, shipping proactive message open rate 34%.

Explore Shopify integration, AI customer support, request a demo.

Which operational playbooks should be launched in 30 days?

Playbook 1: audit topics (2 h)

Export tickets for 90 days per intent. Classify Tier 1/2/3 section 3. Deliverable: list of 8 topics + required API scopes.

Playbook 2: mapping event → message (3 h)

Fill in table section 5 for each Tier 1 topic. Write 6 proactive templates + 6 pull enrichments. Tone of voice review.

Playbook 3: endpoint security (2 h)

HMAC, dedup webhook_id, logs, 200 response < 5 s. 15 sandbox tests section 7. Monitoring failed webhooks alerts.

Playbook 4: go-live Tier 1 (1 d)

Activate orders/create, fulfillments/create, fulfillment_events/create. Proactive cap 2/day/customer. Observe 50 real orders before Tier 2.

Playbook 5: measurement W+4

KPI section 9. Compare WISMO, latency, FCR vs baseline. Activate Tier 2 if endpoint is stable (< 0.1% failed).

Useful links

The webhook is the doorbell: the chatbot opens the door with the right answer before the customer even knocks.

Enzo

June 28, 2026

Convert over 2,000 customers on average per month with Qstomy.

The world’s 1st Shopify AI dedicated to customer conversion

Empowering 200+ e-commerce merchants

Subscribe to the newsletter and get a personalized e-book!

No-code solution, no technical knowledge required. AI trained on your e-shop and non-intrusive.

*Unsubscribe at any time. We do not send spam.

Subscribe to the newsletter and get a personalized e-book!

No-code solution, no technical knowledge required. AI trained on your e-shop and non-intrusive.

*Unsubscribe at any time. We do not send spam.