Quick overview
This workflow connects the WhatsApp Cloud API with a keyword-based FAQ and optional OpenAI fallback to answer customer messages, verifies Meta webhook signatures, supports STOP/START opt-outs and human handoff with owner alerts, and can send booking reminder templates from Google Sheets on a schedule.
How it works
- Receives Meta’s webhook verification GET request and returns the challenge only when the verify token matches.
- Receives incoming WhatsApp webhook POST requests, validates the X-Hub-Signature-256 HMAC signature, and immediately acknowledges Meta or rejects forged requests.
- Splits the webhook payload into individual customer messages, drops duplicate Meta retries by message ID, and processes STOP/START to opt numbers out or back in.
- Suppresses bot replies for chats currently handed off to a human, and routes non-text messages or “talk to a person” phrases directly to handoff.
- For remaining text questions, loads the FAQ from either a built-in list or Google Sheets and matches the best answer by keyword phrases.
- If no keyword match is found and AI fallback is enabled, uses OpenAI to select a single FAQ id (or null) and sends only the stored FAQ answer when the id is valid.
- Sends the reply via WhatsApp, or if no valid FAQ answer is found, sends a handoff acknowledgment to the customer and alerts the owner on WhatsApp while muting the bot for that chat.
- Runs every 30 minutes (optional) to read upcoming bookings from Google Sheets and sends an approved WhatsApp template reminder to eligible customers who have not opted out.
Setup
- Create a Meta app with WhatsApp Cloud API access and add WhatsApp credentials for the nodes that send replies, owner alerts, and template reminders.
- Update the values in the Settings code (verify token, Meta app secret, owner number, and any YOUR_* placeholders such as booking link and phone number ID).
- If you use AI fallback, add an OpenAI credential and confirm the selected model in the OpenAI Chat Model configuration.
- If you use Google Sheets for FAQs and/or bookings, add a Google Sheets credential and set the sheet URLs and tab names in Settings.
- Configure a Header Auth credential for the resume webhook and use it when calling the /whatsapp-support/resume endpoint.
- Activate the workflow and paste the production URL for the /whatsapp-support POST webhook into Meta’s webhook configuration and subscribe to WhatsApp message events.