Orchestrate multi-store order allocation with OpenAI, Postgres, and Slack
Needs changesWhat this workflow does
This AI workflow has 22 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects Postgres, HTTP Request, OpenAI Chat Model and Slack.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Set - Config (Edit Fields (Set)): sets 6 fields: orderId, customerId, items…
- Postgres: select
- If: checks a condition and branches into true / false
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; 4 tools (Tool - Reserve Stock, Tool - Check Store Stock, Tool - Release Reservation, Tool - Get Store Rate Limit Status); memory: Window Buffer Memory
- Set - Parse Agent Output (Edit Fields (Set)): sets 1 field: parsedOutput
- Postgres: uses Postgres
- Postgres: uses Postgres
- If: checks a condition and branches into true / false
- HTTP - Confirm Order (auto) (HTTP Request): calls an HTTP API (POST)
- Slack: uses Slack
…plus 4 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
2 things in this workflow are removed in n8n 3.0. Fix them before you upgrade:
- HTTP Request Tool (legacy) in Tool - Check Store Stock, Tool - Reserve Stock, Tool - Release Reservation…: replace with HTTP Request node connected to the AI Agent's Tool input.
- AI Agent v1 (old agent modes) in AI Agent - Inventory Orchestrator (v1.6): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| HTTP Request Tool (legacy) Tool - Check Store Stock, Tool - Reserve Stock, Tool - Release Reservation, Tool - Get Store Rate Limit Status | HTTP Request node connected to the AI Agent's Tool input |
| AI Agent v1 (old agent modes) AI Agent - Inventory Orchestrator (v1.6) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (12)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Postgres
n8n-nodes-base.postgres - If
n8n-nodes-base.if - No Operation, do nothing
n8n-nodes-base.noOp - HTTP Request Tool
@n8n/n8n-nodes-langchain.toolHttpRequest - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - AI Agent
@n8n/n8n-nodes-langchain.agent - HTTP Request
n8n-nodes-base.httpRequest - Slack
n8n-nodes-base.slack - Wait
n8n-nodes-base.wait
From the author
Quick overview This workflow receives new order webhooks, uses OpenAI to plan and execute inventory reservations across multiple stores via HTTP APIs, logs allocation decisions to Postgres, and either auto-confirms the order in an OMS or requests a manual…