Overview
Every n8n workflow that runs the National Commerce automation layer, grouped by what it does.
n8n (spelled "N8N" elsewhere in these docs) is the workflow tool that glues ShipHero, Supabase, and the portal together. Each workflow is called a flow (n8n also calls them "scenarios"). This section documents one flow per page.
For the big picture of how data moves between systems, read Data Flows first. This section zooms in on each individual n8n flow: its trigger, its steps, and what it reads or writes.
Purchase orders
Build draft purchase orders, push them to ShipHero, and keep Supabase in sync as orders change.
Create PO on ShipHero
Turn a portal form submission into a real ShipHero purchase order.
Hourly: Create Draft POs
Read the replen report each hour and build draft POs for what needs reordering.
Purchase Order Update Handler
Process one ShipHero PO update: upsert the PO, its line items, and SKUs.
ShipHero PO Update → Queue
Catch ShipHero PO webhooks and queue them for the handler.
Notify: New Draft PO Created
Email brand users when a new draft PO appears.
Notify: PO Line Item Discrepancy
Email when a received line item does not match what was ordered.
Pulling Purchase Orders
Manual backfill that imports all POs from ShipHero.
Shipments & inventory
Pull missing shipments into Supabase, keep on-hand inventory counts current, and clean up voided labels.
Missing Shipment Data Pull 2.0 (Backup)
The live daily flow that backfills missing shipment data for every account.
Missing Shipment Data Pull 2.0 (Reconciliation)
Disabled reconciliation copy of the 2.0 flow.
Missing Shipment Data Pull (v1)
The original single-account version, superseded by 2.0.
Backfill Missing Product SKUs
Repair shipment line items that have no product SKU linked.
Update On-Hand Inventory Counts
Sync available quantities from ShipHero into Supabase.
Notify: Shipment Cost Exceeded
Alert when a shipment's label cost passes its postage threshold.
Delete Voided Shipment Labels (Daily)
Remove shipments whose ShipHero labels were voided.
Clear Voided Labels (Manual)
On-demand counterpart to the daily voided-label cleanup.
SKU, brand & onboarding
Resolve and sync SKUs, provision new accounts, and invite portal users.
SKU Information Handler
The shared service that resolves any SKU, creating it from ShipHero if missing.
Pull Brand SKUs
Nightly catalog sync of every SKU for an account.
New Brand Onboarding
Provision a new account end to end and kick off its first pulls.
Invite Users to Client Portal
Invite users, assign roles, and email a set-password link.
ShipHero Login + Case/Base SKU Storage
Inactive prototype that scrapes case SKUs from the ShipHero dashboard.
Get Order Details (Debug)
Manual tool to reconcile orders and shipments.
Insert Customers by Order
One-off backfill of end-customer records from ShipHero orders.
ShipHero auth & infrastructure
Log into ShipHero, keep API tokens fresh, and register the webhooks the other flows depend on.
Log Into ShipHero → Auth Cookies
Simulate the browser login and return session cookies.
ShipHero Access Token Rotation
Refresh each account's public-API token weekly.
Get the 2FA Code
Supply the two-factor code for the ShipHero login flow.
Create ShipHero Hooks (Helper)
Register the ShipHero webhooks used during onboarding.
Supabase RPC: Secret Insert/Read
Reference pattern for storing and reading encrypted secrets.
Send Audit Notification
Email hook for the auditing flow.
Operations, errors & backups
Cross-cutting flows: shared error handling, retries, backups, and reporting.
Error Handler
The shared error workflow that alerts when any flow fails.
Reattempt Failed Runs
Bulk-retry failed executions of a target flow.
Re-Do Error Runs
Repair failed ShipHero-shipment ingestions.
Scenario Backups
Back up every workflow to Google Drive daily.
Map Workflows ↔ Supabase Tables
Audit which Supabase tables each flow touches.
Get Total Execution Usage
Count executions per workflow.
OLD: Process Supabase Queue
Retired queue consumer (kept for reference).
OLD: ShipHero Shipment → Queue
Retired shipment ingestion (kept for reference).
Not documented in detail
n8n also holds a handful of starter samples, throwaway tests, and abandoned experiments with no production logic. They are listed on the Test & scratch workflows page for completeness.