eCommerce · Case Study

From Order Chaos to Automated Fulfillment

A customer pays before lunch. By the afternoon, the warehouse is still waiting for a spreadsheet. Someone resends it, and the same order enters the picking queue twice. The useful design challenge is making a repeated message safe.

Explore eCommerce automation →

How can an eCommerce business automate order fulfillment?

Receive authenticated order events, save them before processing and validate the current order state. A workflow can route eligible orders to the warehouse and synchronize shipment updates. Stable order identifiers and a dispatch ledger prevent repeated events from creating repeated fulfillment requests. Invalid addresses, uncertain warehouse responses and exhausted retries should reach an assigned operator rather than silently disappear. The dispatch ledger makes each handoff traceable to its source order.

incident review

The dangerous moment is the retry

An order can arrive twice without being a duplicate sale. A warehouse can accept a request even when its acknowledgement never reaches the sender. Those two facts explain why simply connecting the APIs is not enough.

  1. Receipt

    Acknowledge only after durable receipt

    Verify the webhook signature against the raw body. Save the event under a unique shop and event key, then acknowledge receipt. A worker processes pending records so a slow warehouse does not hold the webhook request open.

  2. Dispatch

    Separate an event from a dispatch

    Fetch current payment, cancellation and fulfillment state. Validate address and SKU mapping with deterministic rules. Use a separate unique dispatch key for the order and fulfillment version; deduplicating webhook IDs alone cannot prevent two different events from dispatching the same order.

  3. Recovery

    Recover without shipping twice

    Send a stable reference to the warehouse and save its receipt. Retry rate limits and transient failures with bounded exponential backoff and jitter. After a timeout with an unknown outcome, query the partner by reference before resending. If the partner cannot deduplicate or confirm receipt, stop for operator reconciliation.

Interactive demo

Watch an order reach the warehouse once

A dispatch rail separates the original order, its warehouse receipt and a repeated event. Inspect the duplicate branch to see why a second message does not become a second shipment.

Local interactive demo

Webhook replay lab

Fictional records
Unique event receipts0
Warehouse dispatches0
Dispatch referenceNot created
ORDER ORD-1042 / EVENT evt-demo-01
    Try repeated delivery. One event key and one dispatch key protect different parts of the handoff.
    Reference records for this demo
    Order event inbox
    OrderDestinationValidationState
    ORD-1042Warehouse NorthPaid · address verifiedReady
    ORD-1043Warehouse SouthPostal code missingReview
    ORD-1042Repeated webhookExisting dispatch keyDuplicate
    Interactive reconstruction using fictional records. All actions stay in this browser session. No client system, message, purchase, approval or invoice is changed.

    Related implementation: explore another BytePilot workflow.

    Technical details

    One dispatch across repeated messages

    Trace the event and the separate dispatch key. An acknowledgement is saved before a warehouse timeout can become a second shipment.

    Shopify APICurrent order

    Read current order and fulfillment state.

    n8nWorkflow owner

    Coordinate validation, routing and exception notifications.

    PostgreSQLDurable receipts

    Store event receipts, dispatch keys and processing state.

    1. 01
      WebhooksSigned event → durable receipt

      Trigger processing when orders or shipments change.

      Acknowledge after save
    2. 02
      PythonAddress, SKU and payment validation

      Implement validation and partner adapters.

      Reject invalid input
    3. 03
      Unique dispatch referenceThe order and fulfillment version identify one warehouse request.
      Keep the warehouse receipt
    Repeated event?

    Reuse the recorded dispatch. An unknown warehouse outcome needs a lookup before a retry.

    Simplified implementation architecture. Open a technology to inspect its responsibility.

    Receipt checks and dispatch recovery

    Use scoped store and warehouse credentials in a secret store. Redact customer addresses from logs. Monitor queue age, duplicate events, failed dispatches and orders missing tracking. A scheduled reconciliation compares paid unfulfilled orders with the dispatch ledger to catch missed webhooks.

    Replay the events that can ship an order twice

    Replay duplicate and out-of-order events, cancel an order during validation and simulate a warehouse timeout after acceptance. Pilot one warehouse with a manual dispatch fallback. Disable the old spreadsheet dispatch path for pilot orders to avoid parallel fulfillment.

    Technical references: Shopify webhook verification and duplicate handling.

    Speed matters. A second shipment matters more.

    Read processing speed alongside dispatch integrity. A short queue is a poor result if the warehouse receives the same instruction twice. The measures below define a reliability review; they are not published performance results.

    Dispatch integrity

    Duplicate dispatch rate

    Confirmed repeated fulfillment requests per eligible order, checked against warehouse receipts.

    Read this before treating a faster dispatch as a better dispatch.

    Order processing latency

    Median and 95th percentile from durable event receipt to warehouse acknowledgement, excluding and separately reporting held orders.

    Manual touches per order

    Operator actions in the exception ledger divided by processed orders, compared with a sampled manual baseline.

    Exception resolution time

    Elapsed time from exception creation to a recorded resolution, grouped by cause.

    Retries, warehouses and duplicate messages

    What if Shopify sends the same webhook twice?

    A unique event key suppresses repeated ingestion. A separate dispatch key protects the warehouse side effect across different events for the same order.

    Can this work with more than one warehouse?

    Yes in the implementation scope, once stock ownership, routing and split-fulfillment rules are agreed. Each fulfillment allocation needs its own stable dispatch reference.

    Does every failed request get retried?

    No. Invalid addresses and rejected SKUs need correction. Unknown partner outcomes require a receipt lookup before any resend.

    Is an AI model needed to route orders?

    No. Payment state, address requirements and warehouse routing should use explicit rules that operators can inspect.

    Related case studies

    RETURNS / RET-214Agent workspace
    CUSTOMER
    I would like to return the unopened item from my order.
    ASSISTANT DRAFT · NOT SENT
    Your order is within the standard return window. Please confirm the item condition for our support team.
    Reply approval: support agent
    Sample data · Interactive demo inside
    eCommerce

    An AI Returns Assistant That Knows When to Escalate

    Support agents repeatedly find orders, interpret return policies and ask for missing details.

    • Claude
    • FastAPI
    • Redis
    • Zendesk API
    • AWS Lambda
    View case study
    CHANNEL INTELLIGENCESample period · MYR
    NET REVENUE · DEMORM 114,000
    Five source feeds
    42kDirect
    28kMarket A
    19kMarket B
    14kSocial
    11kWholesale
    DirectRM 42,000Inspect order facts, refund period and source freshness.
    Sample data · Interactive demo inside
    eCommerce

    One Revenue Dashboard Across Five Sales Channels

    Sales, advertising, refunds and fulfillment costs use incompatible channel definitions.

    • BigQuery
    • Airbyte
    • dbt
    • Looker Studio
    • SQL
    View case study

    Discuss your order handoffs

    Bring the order that was hardest to untangle

    Trace one paid order through the store, warehouse and delivery partner with us. The first useful question is which system can prove that a dispatch was accepted after the sender lost its connection.

    Discuss your order handoffs →

    Workflow Automation · Choosing a workflow to automate

    Order investigation file
    Trace the record

    An order history with a failed handoff

    Check the partner

    The warehouse lookup and cancellation rules