đź’¬ Answer WhatsApp gold chain enquiries using Google Sheets and Twilio
⚡ 0 views · 💬 Support Chatbots
Description
Quick overview
This workflow receives incoming Twilio WhatsApp messages, looks up gold chain availability and last-approved prices from Google Sheets (or built-in demo stock), optionally uses an OpenAI-compatible model to parse what the customer wants, and replies with matching in-stock items or escalates complex requests to the owner.
How it works
- Receives an inbound WhatsApp message via a Twilio webhook (or uses built-in demo messages when run manually).
- Loads the current catalogue from a Google Sheets Stock tab, or falls back to the workflow’s demo stock data if no sheet is configured.
- Parses the customer’s text to extract style, karat, length, and quantity using keyword rules, optionally refining those fields with an OpenAI-compatible chat completion request.
- Builds a response based on the sheet data: confirms opt-out requests, escalates bulk/orders/custom/complaints to the owner, or returns up to three closest in-stock matches with quantities and list prices.
- Routes messages based on mode (preview/test/live) and sends replies and owner alerts through Twilio WhatsApp, or outputs a preview when sending is disabled.
- If the customer opted out and live writing is enabled, updates the Google Sheets Customers tab to mark the WhatsApp number as opted out.
Setup
- Create a Twilio WhatsApp sender and configure Twilio’s “A message comes in” webhook to POST to this workflow’s webhook URL.
- Add Twilio credentials in n8n and set your WhatsApp sender number in
TWILIO_WHATSAPP_FROMand your escalation number inOWNER_WHATSAPPin the config. - Create a Google Sheet with Stock and Customers tabs (and the expected columns), add Google Sheets credentials in n8n, and set
SHEET_IDin the config. - (Optional) Add an OpenAI API key (or compatible endpoint) and set
AI_API_KEY,AI_BASE_URL, andAI_MODELin the config to improve message parsing. - Choose your run mode by setting
TEST_RUNand (optionally)TEST_WHATSAPPin the config before switching to live sending and writing.
đź”— Nodes Used
Google Sheets, HTTP Request, Twilio, Webhook
📥 Import
Download workflow.json and import into n8n:
Workflow menu → Import from File