{"product_id":"multi-store-order-allocation-workflow-with-openai-postgres-slack","title":"Multi-Store Order Allocation Workflow with OpenAI, Postgres \u0026 Slack","description":"\u003ch3\u003eAutomatically allocate multi-store inventory for every new order—then confirm or get ops approval via Slack\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow receives new order webhooks, uses \u003cstrong\u003eOpenAI\u003c\/strong\u003e to plan and execute \u003cstrong\u003einventory reservations across multiple stores\u003c\/strong\u003e via HTTP APIs, logs the full allocation decision trail to \u003cstrong\u003ePostgres\u003c\/strong\u003e, and either \u003cstrong\u003eauto-confirms\u003c\/strong\u003e the order in your OMS or sends a \u003cstrong\u003eSlack review request\u003c\/strong\u003e for partial\/failed fulfillment.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIngest orders via Webhook:\u003c\/strong\u003e Accepts a POST webhook containing order ID, customer ID, line items, and optional candidate stores.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePrevent duplicate processing:\u003c\/strong\u003e Creates an order-scoped idempotency key and checks \u003cstrong\u003ePostgres\u003c\/strong\u003e to ignore deliveries already processed for the same order.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePlan + reserve with OpenAI:\u003c\/strong\u003e 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.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAudit every decision:\u003c\/strong\u003e Parses the agent’s JSON output and writes the allocation plan, reservations, verdict, and any shortfalls to \u003cstrong\u003ePostgres\u003c\/strong\u003e for traceability.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eConfirm or escalate:\u003c\/strong\u003e If the verdict is to confirm, sends the allocation plan to the \u003cstrong\u003eOMS confirmation endpoint\u003c\/strong\u003e. If review is needed, posts a shortfall summary and allocation details to \u003cstrong\u003eSlack\u003c\/strong\u003e, waits for an ops decision, then confirms or cancels via the OMS API.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eHigh-volume e-commerce operations that need \u003cstrong\u003emulti-store fulfillment decisions\u003c\/strong\u003e without manual spreadsheets.\u003c\/li\u003e\n  \u003cli\u003eTeams that require \u003cstrong\u003ereservation audit logs\u003c\/strong\u003e in Postgres for operational transparency.\u003c\/li\u003e\n  \u003cli\u003eOrder flows where partial stock must trigger a \u003cstrong\u003eSlack approval gate\u003c\/strong\u003e before OMS confirmation.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n nodes:\u003c\/strong\u003e if, set, no op, wait, slack, webhook\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIntegrations:\u003c\/strong\u003e \u003cstrong\u003eOpenAI\u003c\/strong\u003e (agent), \u003cstrong\u003ePostgres\u003c\/strong\u003e (e.g., tables like \u003ccode\u003einventory_orders\u003c\/code\u003e and \u003ccode\u003einventory_reservations\u003c\/code\u003e), \u003cstrong\u003eSlack\u003c\/strong\u003e, HTTP tools for per-store stock\/reservation and OMS endpoints\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI model:\u003c\/strong\u003e Uses \u003cstrong\u003egpt-4.1\u003c\/strong\u003e (ensure it’s available in your OpenAI account)\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46019000762547,"sku":"N8N-19550","price":11.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/EXCPv_0cvyv_vGkjdi7fF_ZBhfQlBG.png?v=1789376764","url":"https:\/\/buyflowscripts.com\/products\/multi-store-order-allocation-workflow-with-openai-postgres-slack","provider":"N8N Commerce","version":"1.0","type":"link"}