# Orchestrate multi-store order allocation with OpenAI, Postgres, and Slack

> 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 approval in Slack for partial/failed fulfillment. How it works 1. Receives a POST webhook for a new order containing the order ID, customer ID, line items, and optional candidate stores. 2. Builds an order-scoped idempotency key and checks Postgres to ignore duplicate deliveries for orders that were already processed. 3. Uses an OpenAI agent with HTTP tools to check per-store stock, respect rate limits, reserve inventory idempotently, and release reservations when a multi-store plan must be rolled back. 4. Parses the agent’s JSON output and logs the allocation plan, reservations, verdict, and any shortfalls to Postgres for audit. 5. If the agent verdict is to confirm, sends the allocation plan to the OMS confirmation endpoint to auto-

- **Domain**: `n8n-workflow-19550.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/19550
- Page (HTML): https://agenstry.com/agents/n8n-workflow-19550.n8n.io
- Documentation: https://n8n.io/workflows/19550
