Hourly: Create Draft POs
Turned off. Used to evaluate the replenishment report each hour and write draft purchase orders and line items into Supabase.
This was the automated replenishment engine. Every hour it checked which SKUs needed reordering and created or updated draft purchase orders, grouped by warehouse and brand.
Turned off on September 24, 2026
This flow no longer creates or updates draft POs. Drafts now come only from the manual create form, the assistant, and a brand's response to its replenishment request. Drafts it created before it was turned off were left as they are. The flow is kept in n8n, unpublished, so it can be turned back on if needed. If it is, its notification step will fail, because Notify: New Draft PO Created was retired on October 7, 2026.
At a glance
- Status: Inactive (unpublished September 24, 2026)
- Trigger: Schedule Trigger, every hour at minute 10, no longer firing. A disabled webhook (
/webhook/inventory_updated) exists for an alternative live mode but is off. - Runs on: Nothing. It ran on the hourly schedule while active.
- Talks to: Supabase (a replenishment RPC plus the Draft PO, Draft PO Line Items, Base SKUs, Brands, and Vendors tables); pings Notify: New Draft PO Created, which is retired.
How it works
Run Inventory Reportcalls the Supabase RPCinventory_replen_report_for_draft_PO_creation(trailing 14 days, order interval 7, safety stock 4) over REST.- A filter keeps only Active items where available stock (on-hand plus inbound) is below the reorder threshold and
minimum_reorder_qty > 0; a guard node short-circuits when nothing is due. - Each item is enriched with its Base SKU and
brand_id. Loop Over Itemswalks each SKU: it either updates an existing draft PO line item or creates a new one.- The line item attaches to an existing draft PO for that warehouse and brand, or a new Draft PO is created (random-suffixed name, status Draft) after looking up the brand and vendor.
- When a new PO is created, the flow fires the draft-PO notification webhook.
Notes
- Supabase auth tokens are hardcoded in the report node's headers.
- The live webhook mode was deliberately disabled because it consumed too many executions (explained in a sticky note).
- Shared
error-handlerset as the error workflow.