Forecast inventory and auto-generate reorders with Google Sheets, GPT-4o mini and Slack
Ready for 3.0What this workflow does
This AI workflow has 14 nodes and runs manually, when you click “Execute workflow”. Along the way it connects Google Sheets, OpenAI Chat Model and Slack.
How it runs
Trigger: Manually, when you click “Execute workflow”.
- Set Forecast Configuration (Edit Fields (Set)): sets 6 fields: lookback_days, forecast_days, low_stock_threshold_days…
- Fetch Sales History (Google Sheets): uses Google Sheets
- Fetch Current Inventory (Google Sheets): uses Google Sheets
- Merge: merges the data from its input branches
- Build Forecast Dataset (Code): runs custom JavaScript code
- Demand Forecast Agent (AI Agent): runs an AI agent, with model: OpenAI Chat Model
- Generate Purchase Orders (Code): runs custom JavaScript code
- Combine Forecast and AI Output (Code): runs custom JavaScript code
- Log Forecast Completion (Edit Fields (Set)): sets 7 fields: status, report_date, products_analyzed…
- Critical Stock Exists? (If): checks a condition and branches into true / false
…plus 2 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- Manual Trigger
n8n-nodes-base.manualTrigger - Code
n8n-nodes-base.code - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets - Merge
n8n-nodes-base.merge - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - If
n8n-nodes-base.if - Slack
n8n-nodes-base.slack
From the author
How it works Fetches sales history and current inventory from Google Sheets in parallel, then calculates days of stock remaining, average daily sales velocity, and projected stockout dates for every product An AI agent (GPT-4o mini) analyzes the snapshot and…