Quick overview
This workflow powers a chat-based shopping assistant using OpenAI for conversation, an HTTP product-catalog search API for live item data, and a checkout/order API to place orders with explicit user approval, then posts the final order status to a Slack channel.
How it works
- Triggers from an n8n Chat Trigger (or a manual test run) when a user submits a shopping request.
- Uses OpenAI (GPT-4.1-mini) with short-term memory and function calling to query a product-catalog search API for real-time price and availability before recommending up to three items.
- Parses the agent’s structured JSON response into a reply, an optional product shortlist, and a purchase-intent signal with selected product and quantity.
- If there is no purchase intent, returns the direct reply message; if there is purchase intent, pauses for the user to confirm the product selection via a resume webhook.
- Pauses again for an explicit purchase approval via a second resume webhook, then submits the order to the store checkout API with the selected item, quantity, customer, payment method, and shipping details.
- Waits for an asynchronous order-confirmation callback via a third resume webhook, then formats the order status and posts it to Slack.
Setup
- Add credentials for OpenAI, Slack, and HTTP Header Auth for both the product-catalog search API and the checkout/order API.
- Update the configuration values for catalog and order base URLs, currency, customer ID, default shipping address, payment method ID, max budget, and the target Slack channel.
- Copy the resume webhook URLs from the selection, approval, and order-confirmation wait steps and wire them into your chat UI buttons and your store/payment provider’s order-status callback.