An end-to-end order management automation built in n8n that handles customer orders received via WhatsApp, parses them with AI, generates a payment link, and notifies the fulfilment team — all without human intervention.
This workflow automates the full order lifecycle for a food business:
- Customer sends a WhatsApp message with their order
- AI parses the message and matches items to the product catalogue
- A Stripe payment link is generated and sent back to the customer
- On payment confirmation, the order is logged and the kitchen is notified
flowchart TD
subgraph ORDER["ORDER FLOW — WhatsApp to Payment"]
A([📱 WhatsApp]):::whatsapp
A --> B{Text?}:::gate
B -->|No| STOP1([🚫 Stop]):::stop
B -->|Yes| C[📋 Catalogue]:::sheets
C --> D[🤖 AI Parse]:::ai
D --> E{Unknown?}:::gate
E -->|Yes| F([💬 Clarify]):::whatsapp
E -->|No| G[💳 Stripe Link]:::stripe
G --> H([📲 Send Link]):::whatsapp
end
subgraph PAYMENT["PAYMENT FLOW — Stripe to Fulfilment"]
P([🔔 Stripe Webhook]):::stripe
P --> Q{Paid?}:::gate
Q -->|No| STOP2([🚫 Discard]):::stop
Q -->|Yes| R[📝 Log Order]:::sheets
R --> S([✅ Confirm]):::whatsapp
S --> T([📣 Notify Team]):::telegram
end
G -.->|metadata| P
classDef whatsapp fill:#25D366,color:#fff,stroke:#128C7E,stroke-width:2px
classDef stripe fill:#635BFF,color:#fff,stroke:#4B44C7,stroke-width:2px
classDef sheets fill:#34A853,color:#fff,stroke:#1E7E34,stroke-width:2px
classDef ai fill:#FF6B35,color:#fff,stroke:#E55A2B,stroke-width:2px
classDef telegram fill:#2CA5E0,color:#fff,stroke:#1A8BC7,stroke-width:2px
classDef gate fill:#1E1E2E,color:#fff,stroke:#888,stroke-width:2px
classDef stop fill:#E53E3E,color:#fff,stroke:#C53030,stroke-width:2px
| Service | Role |
|---|---|
| n8n | Workflow automation engine |
| Twilio | WhatsApp messaging (inbound and outbound) |
| OpenAI GPT-4o-mini | Natural language order parsing |
| Google Sheets | Product catalogue and order logging |
| Stripe Checkout | Payment link generation and confirmation webhook |
| Telegram | Fulfilment team notifications |
| Node | Type | Description |
|---|---|---|
| Twilio WhatsApp Webhook | Webhook | Entry point. Receives incoming WhatsApp messages via Twilio and exposes Body (message text) and From (sender phone) |
| Is Text Message? | IF | Validates the message has a text body. Routes to the order flow on TRUE, stops on FALSE |
| Get Product Catalogue | Google Sheets | Reads all rows from the Products sheet — product IDs, names, and prices |
| Parse Order with AI | OpenAI | Sends the customer message and catalogue to GPT-4o-mini. Returns a structured JSON order with matched items, quantities, line totals, and flags unrecognised items as UNKNOWN |
| Unknown Items? | IF | Checks the AI output for UNKNOWN items. Routes to clarification on TRUE, payment on FALSE |
| Ask for Clarification | Twilio | Sends a WhatsApp reply listing all available menu items and asks the customer to resubmit |
| Create Stripe Payment Link | HTTP Request | Creates a Stripe Checkout Session with the order total. Embeds customer_phone, order_total, and order_items in session metadata for retrieval after payment |
| Send Payment Link via WhatsApp | Twilio | Sends the customer their order total and a unique Stripe payment URL via WhatsApp |
| Node | Type | Description |
|---|---|---|
| Stripe Payment Webhook | Webhook | Entry point. Receives Stripe event payloads after checkout activity |
| Payment Succeeded? | IF | Filters to checkout.session.completed events only. Discards all other event types |
| Log Order to Google Sheets | Google Sheets | Appends a new row to the Orders sheet with order ID, timestamp, customer phone, items, total, Stripe payment reference, and fulfilment status |
| Confirm Order to Customer | Twilio | Sends the customer a WhatsApp confirmation that their payment was received and their order is being prepared |
| Notify Fulfilment Team | Telegram | Sends a Telegram message to the kitchen group with the customer details and order total |
Why Stripe Checkout Sessions instead of Payment Links?
Checkout Sessions support metadata, which allows the workflow to embed the customer phone number and order data at the time of payment creation. This data is then retrievable in the Stripe webhook event, solving the cross-execution data problem — the payment webhook fires in a separate n8n execution and cannot access data from the original WhatsApp execution.
Why does the workflow branch at Unknown Items??
The AI parser flags any item it cannot confidently match to the catalogue as UNKNOWN. Rather than silently dropping unrecognised items or proceeding with an incorrect order, the workflow asks the customer to clarify, reducing fulfilment errors.
Why log the order at the Stripe node rather than after the AI parse? Orders are only logged once payment is confirmed. This keeps the Orders sheet clean — it reflects real revenue rather than abandoned or unpaid orders.
| Column | Description |
|---|---|
product_id |
Unique identifier (e.g. P001) |
product_name |
Display name used for matching |
price |
Unit price in USD |
| Column | Description |
|---|---|
order_id |
Auto-generated (ORD-timestamp) |
timestamp |
ISO 8601 datetime |
customer_phone |
WhatsApp number (e.g. whatsapp:+2348012345678) |
items_ordered |
Full JSON from AI parser |
order_total |
Numeric total in USD |
payment_status |
Paid / Pending |
stripe_payment_id |
Stripe payment intent ID |
fulfilment_status |
Preparing / Ready / Delivered |
notes |
Optional free text |
The system prompt instructs GPT-4o-mini to:
- Match customer message items to the catalogue by name (fuzzy match)
- Return only a valid JSON object — no markdown, no backticks, no prose
- Flag unmatched items with
product_id: UNKNOWNrather than omitting them - Include
quantity,unit_price, andline_totalper item - Calculate and return
order_total
This strict output contract ensures downstream JSON.parse() calls never fail on unexpected formatting.
This version of the workflow is fully mocked for portfolio demonstration. No external API credentials are required.
| Integration | Mock behaviour |
|---|---|
| Google Sheets (read) | Returns a hardcoded 14-item menu catalogue |
| OpenAI | Returns a hardcoded parsed order (2× Jollof Rice + 1× Chicken Suya = $22) |
| Stripe | Returns a mock checkout URL and payment intent ID |
| Twilio (all nodes) | Outputs the message text and recipient without sending |
| Telegram | Outputs the notification text without sending |
To trigger the demo, import the workflow into n8n and click Test workflow. The full chain executes end-to-end with realistic data at every step.
- Import
WhatsApp_Order_Processor.jsoninto your n8n instance - Credentials — connect the following in n8n:
- Google Sheets OAuth2
- OpenAI API key
- Twilio Account SID + Auth Token
- Stripe API key (set as HTTP Header Auth:
Authorization: Bearer sk_live_...) - Telegram Bot Token
- Google Sheets — create a spreadsheet with
ProductsandOrderstabs matching the schema above - Twilio — configure your WhatsApp sender to POST to the
twilio-whatsappwebhook URL - Stripe — add a webhook in the Stripe dashboard pointing to the
stripe-confirmedwebhook URL, subscribed tocheckout.session.completed - Telegram — replace
YOUR_TELEGRAM_GROUP_IDin the Notify node with your group or channel ID - Stripe URLs — update
success_urlandcancel_urlin the Create Stripe Payment Link node - Activate the workflow
Built as a portfolio project demonstrating real-world automation with n8n, integrating AI-powered order parsing, payment processing, and multi-channel communication in a single automated pipeline.