National Commerce Docs
n8n flows

Missing Shipment Data Pull 2.0 (Backup)

The live 2.0 flow that pulls missing ShipHero shipment data into Supabase for every active brand and reconciles the full shipment graph.

This is the production "2.0" pull. It backfills missing ShipHero shipment data into Supabase for all active brands and reconciles the whole graph: orders, packages, line items, Product SKUs, customers, stores, warehouses, and shipping zones.

At a glance

  • Status: Active, the live version of the 2.0 pull.
  • Trigger: Daily schedule (~03:00), a self-restarting webhook, and a manual Test trigger.
  • Runs on: Every active brand, one brand/date at a time.
  • Talks to: ShipHero GraphQL, Supabase, the National Commerce app API (shipment zones), and internal n8n webhooks (SKU lookup, self-restart, voided-label cleanup).

How it works

  1. The schedule or self-restarting webhook fires, and a merge node normalizes the cursor, date, and brand inputs.
  2. It pages ShipHero shipments day-by-day for one brand, self-restarting through its webhook to advance dates and dodge execution timeouts, with ShipHero rate-limit wait handling.
  3. It upserts Shipments, Orders, Shipment Line Items, Product SKUs, and Warehouses, plus the m2m links between them, and creates or links customers and brand stores.
  4. It computes shipping zones by calling the app API /api/shipment-zones/get-zone, looking up the origin warehouse and saving the zone (or an error) back to Supabase.
  5. It fixes changed line-item quantities, links stores to both orders and shipments, and calls the voided-labels webhook to remove voided shipments for the brand.

Notes

  • The flow re-POSTs to its own webhook to paginate and advance dates. This is intentional: it keeps each execution short so long runs never hit the timeout.
  • It only saves labels ShipHero marks as valid. ShipHero's voided: false filter works per shipment, so a live shipment can still return a label it voided; skipping it keeps the flow from re-adding a label the voided-label cleanup has just deleted.
  • When a package without a tracking number matches several rows, the flow leaves them alone instead of deleting all but one as duplicates. A pallet shipment has one row per pallet and none of them is tracked, so they are separate packages, not copies.
  • This is a superset of the reconciliation copy (~160 nodes): it adds shipment-zone calculation, order/shipment store linking, and quantity-fix logic.

On this page