Google review ask
One message with your review link. Never twice in a week, and never after a complaint.
From our reel: most restaurants lose every guest the moment they pay the bill. One QR code on the table fixes that. It opens WhatsApp, where an AI Captain answers menu questions and takes the order, then a quiet automation brings the guest back. Below is the full flow and the Claude prompts to build it on the WhatsApp API through MSG91.

It's a WhatsApp chatbot for your restaurant that starts from a table QR code, answers questions from your real menu, takes the order, and then keeps the guest coming back with messages that send themselves. It runs on the official WhatsApp Business API (here through MSG91), an AI model, and a small server. Nothing to install for the guest. For the owner, it's restaurant marketing that turns a one-time visit into a regular.
This is what Priya sees on her phone. Every step on the left is a line on the right.
One QR code on the table opens WhatsApp with a message already typed. No app, no menu card.
The guest shares their name and gets a free-item code. That's their yes to hearing from you on WhatsApp.
The AI Captain answers menu questions from your real menu and takes the order in the same chat.
After the meal it asks for a Google review, so the next guest finds you.
From then on the automation brings them back on its own, with offers nobody has to remember to send.
Five messages nobody on your staff has to remember to send.
One message with your review link. Never twice in a week, and never after a complaint.
If the code from the first visit hasn't been used: “your free dessert is still waiting.”
A gift offer in the week of their birthday, if they shared it.
Once the free item is redeemed, a referral code for a friend.
No visit in a month? A short note with a reason to come back.
Paste them in order into one Claude chat (or Claude Code). Together they build a small Node.js app that talks to the WhatsApp API through MSG91: the QR opt-in, the AI Captain, the review ask and the automatic messages. Before you start you need an MSG91 account with your WhatsApp number connected, an AI API key, and a server with HTTPS.
Start here. Everything else sends through these two functions.
You are a senior Node.js developer. Create a small Node.js (Express) project for a restaurant's WhatsApp assistant that talks to WhatsApp through MSG91.
Read secrets from environment variables only, never hard-code them: MSG91_AUTHKEY, MSG91_INTEGRATED_NUMBER (the WhatsApp number connected in MSG91, digits with country code), ANTHROPIC_API_KEY (or OPENAI_API_KEY), GOOGLE_REVIEW_URL, MANAGER_WHATSAPP, KITCHEN_WHATSAPP.
Write msg91.js with two functions:
1. sendText(to, text): a free-form session message, which WhatsApp only allows within 24 hours of the customer's last message. POST to MSG91's WhatsApp outbound message endpoint (https://api.msg91.com/api/v5/whatsapp/whatsapp-outbound-message/) with the authkey header, integrated_number, the recipient number and content_type "text".
2. sendTemplate(to, templateName, bodyVariables, languageCode = "en"): an approved template message via https://api.msg91.com/api/v5/whatsapp/whatsapp-outbound-message/bulk/ with a body like:
{ "integrated_number": "...", "content_type": "template", "payload": { "messaging_product": "whatsapp", "type": "template", "template": { "name": "...", "language": { "code": "en", "policy": "deterministic" }, "namespace": null, "to_and_components": [ { "to": ["91XXXXXXXXXX"], "components": { "body_1": { "type": "text", "value": "..." } } } ] } } }
Check both request shapes against MSG91's current WhatsApp API docs before you finish, and tell me anything that differs. Normalise Indian numbers to 91XXXXXXXXXX. Log every send (to, type, status) and return MSG91's response. Add .env.example and a README section on the env vars.Paste the webhook URL into MSG91 → WhatsApp → your number → Webhooks.
Add POST /webhooks/msg91/inbound for MSG91's inbound WhatsApp webhook. Parse the sender number, message text, message id and timestamp. Log the raw body the first time so we can confirm MSG91's field names, and adjust the parser to match.
Ignore duplicate deliveries by message id. Respond 200 fast and process asynchronously.
Store customers in SQLite (better-sqlite3) with: phone, name, opted_in (bool), opted_in_at, state (which question we're waiting on), last_message_at, birthday (nullable, DD-MM), free_item_code, code_expires_at, code_redeemed_at, visits, referral_code, referred_by, last_marketing_at.
If the text is STOP, set opted_in = false, confirm in one line, and never send that number anything again unless they message START.
Add POST /webhooks/msg91/status for sent / delivered / read / failed receipts and store them against the message.Print one QR per table. The table number rides along in the message.
Create the table QR flow.
1. A script that writes printable QR PNGs for tables 1–20 (qrcode npm package). Each QR is a wa.me click-to-chat link to MSG91_INTEGRATED_NUMBER with the prefilled text "Hi! Table {n}".
2. When a new number messages us: reply (as a session message) with a short welcome that asks for their name, says they'll get updates and offers from us on WhatsApp, and says they can reply STOP anytime. Remember the table number.
3. When they reply with a name: save it, set opted_in = true with a timestamp, create a unique 6-character free-item code valid 14 days, and send it.
4. Optionally ask for their birthday as DD-MM so we can send a birthday treat. Accept "skip".
Use the customer's state field so each reply is matched to the question we asked. Handle someone who scans again later: greet them by name, no second code.Give it your real menu. This is the step that stops it inventing dishes.
Add the AI Captain. Load menu.json (I'll paste the real menu): each item has id, name, category, price, veg (true/false), tags such as "gluten-free", "jain", "spicy", and available (true/false).
For any message from an opted-in customer that isn't an answer to an opt-in question, call the AI model with a system prompt that says:
- You are the restaurant's WhatsApp captain.
- Answer ONLY from the menu JSON you are given. If a dish, price, ingredient or offer isn't in it, say you're not sure and offer to call a staff member.
- Never invent dishes, prices, offers or ingredients.
- Reply in the customer's language (English, Hindi or Hinglish), under 60 words.
Have the model also return order actions as JSON (add item id + qty, remove, confirm). Validate every item id against menu.json and skip unavailable items. Keep a cart per customer. On confirm, show the order with total and table number and ask "Confirm? Yes / No". On Yes, save the order and send it to KITCHEN_WHATSAPP with sendText (log it too).
Add tests for: "anything gluten-free?", a dish that isn't on the menu, and a two-item order with one change.Ask once, at the right moment, and never after a complaint.
When an order is marked served (add POST /orders/:id/served for staff, with a 90-minute fallback timer), send the approved template "review_request" with the customer's name and GOOGLE_REVIEW_URL.
Send it once per visit and at most once in 7 days. If the customer's recent messages read as a complaint (ask the AI model to classify sentiment), don't send the review link. Forward the complaint to MANAGER_WHATSAPP instead.This is the part that brings customers back without anyone remembering.
Add a daily scheduler (node-cron, 11:00 IST) that sends approved templates to opted-in customers only:
1. birthday_treat on their birthday (if we have it).
2. free_item_reminder 7 days after the code was issued, if it hasn't been redeemed and hasn't expired.
3. refer_friend the day after a customer redeems their free item, with their referral_code.
4. win_back 30 days after the last visit.
Add POST /codes/:code/redeem for staff: it marks the code redeemed, counts a visit, and credits referred_by if the code was a referral.
Rules: at most one marketing message per customer per 7 days, skip anyone opted out, log every send, and a DRY_RUN=true mode that prints what would be sent without sending.Run the whole thing on your own number before a single guest sees it.
Write a test plan and a go-live checklist for this project:
1. Run everything with DRY_RUN=true and my own number as the only customer, scan to birthday.
2. The exact WhatsApp templates to submit for approval in MSG91 (review_request, birthday_treat, free_item_reminder, refer_friend, win_back), with suggested text in English and Hinglish, their variables, and the right category (utility or marketing).
3. How to set the inbound and status webhook URLs in MSG91.
4. Deployment on a small server or Cloud Run with HTTPS, and where to keep the env vars.
5. What to monitor each week: failed sends, opt-outs, template rejections, and orders that never got confirmed.Rather not wire up webhooks and templates yourself? We'll hand you the working MSG91 integration code, or run the whole setup on your number.Get the integration code
Replies inside 24 hours of the guest's last message can be free-form. Everything after that (review ask, reminders, birthday, win-back) needs a template approved by Meta. Submit them in MSG91 before launch.
Message only guests who opted in by scanning and sharing their name. Honour STOP instantly. Bulk-messaging from a personal WhatsApp number is how numbers get banned. This uses the official API instead.
Meta charges per template message, billed through your provider (MSG91 here). Session replies to a guest who just messaged you are usually much cheaper. Check MSG91's current rates and cap marketing to one message a week.
The AI Captain answers only from your menu file, with prices and availability from that file, and says “not sure” otherwise. Update menu.json when the menu changes, and it never quotes a dish you don't serve.
| QR code menu (PDF) | Delivery apps | WhatsApp AI Captain | |
|---|---|---|---|
| Who has the guest's number | Nobody | The delivery app | You, with their opt-in |
| Answers “anything gluten-free?” | No | Filters, no questions | Yes, from your real menu |
| Takes the order at the table | No, a waiter does | Not for dine-in | Yes, in the WhatsApp chat |
| Asks for a Google review | No | Reviews stay on the app | Yes, after the meal |
| Brings the guest back | No | The app's offers, on the app | Birthday, win-back and referral messages |
| What it costs | Free | Commission on every order | Per-message WhatsApp fees + a one-time setup |
Tell us about your restaurant or cafe. We'll send the working MSG91 + WhatsApp integration code, or set up the AI Captain for you on your number, with your menu. See the full WhatsApp automation service.
Prefer to chat? DM us on Instagram