If you run a restaurant, grocery store, or any retail business, you're probably still taking orders over the phone or through informal WhatsApp chats. This means missed orders, manual effort, and no order tracking. Let's fix that.
What We'll Build
A WhatsApp bot that: greets new customers, shows the menu, lets them add items to a cart by replying with numbers, confirms the order, notifies the kitchen or owner, and logs everything to Google Sheets.
Prerequisites
- n8n instance (self-hosted or cloud)
- Meta Cloud API account (WhatsApp Business)
- Google Sheets account
- Your menu in a spreadsheet
The Key Concept: Conversation State
The tricky part of a WhatsApp bot is remembering where in the conversation each customer is. We solve this with n8n's built-in Static Data store, keyed by the customer's phone number.
Step 1: Set Up the Meta Cloud API Webhook
In n8n, create a Webhook trigger. In Meta's developer console, configure your WhatsApp app's webhook URL to point to this n8n webhook. Subscribe to the "messages" field.
Step 2: Parse the Incoming Message
Add a Function node to extract the sender's phone number, message text, and message type from the webhook payload. This becomes your routing logic.
Step 3: Build the State Machine
Use n8n's Switch node to route based on the customer's current state: NEW → send welcome + menu; BROWSING → handle item selection; CART → handle checkout; ORDER_PLACED → confirm and notify.
Get More Like This
AI automation tips and n8n tutorials every 2 weeks. No spam.