Problem
Wholesale distributors manage inventory manually. Someone checks stock each morning, decides what to reorder, emails suppliers, and logs it somewhere. Across multiple suppliers, that is daily procurement work that follows the same logic every time. Stockouts are expensive. Over-ordering ties up cash. The data to make better decisions already exists. It just isn't automated.
Solution
A scheduled workflow that runs every morning. It loads current inventory levels across all SKUs, sends the dataset to Claude AI, and receives back a structured reorder analysis. Which items are critical, quantities needed, why each was flagged, and total PO value per supplier. It then generates purchase orders, emails suppliers, logs the run, and posts an ops summary to Slack. All before the workday starts.
Demo
Results
- 15 SKUs across 5 suppliers analyzed daily
Scheduled trigger loads 15 SKUs covering 5 categories across 5 suppliers. A Code node formats the inventory as a structured markdown table and builds the full Claude API request with a precise system prompt and urgency scoring rules. An HTTP Request node posts to OpenRouter's chat completions endpoint (Claude 3.5 Sonnet), receiving a structured JSON response with the full reorder analysis. A Parse AI Response Code node extracts the reorder items, strips any markdown wrapping, handles JSON parse failures gracefully, and groups items by supplier for PO generation. An IF node branches on reorder count: if zero items need reorder, the false path returns a 'all stock nominal' summary. On the true path, a Format PO Code node builds professional purchase order text per supplier with SKU details, urgency flags, quantities, and line totals. Gmail sends the first supplier's PO. Google Sheets appends the run log. Slack posts the ops summary. Key pattern: HTTP Request nodes replace $json with their API response. All downstream nodes reference upstream data via $('Parse AI Response').item.json.field to avoid data loss across the pipeline.
Tech Stack
- n8n
- Claude AI
- OpenRouter API
- Gmail API
- Google Sheets API
- Slack
- JavaScript
- Scheduled Triggers