An r/n8n WhatsApp automation thread surfaced the production gap: most bots are template-based and break on out-of-script questions. Adding live web context via Scavio fixes it. This walks the n8n stack.
Prerequisites
- n8n cloud or self-host
- WhatsApp Business API account (Meta-verified)
- Scavio API key
- An LLM API key (Claude/OpenAI)
Walkthrough
Step 1: Wire WhatsApp Business webhook into n8n
n8n has a native WhatsApp Trigger node.
// n8n UI: Add Trigger > WhatsApp Business Cloud > 'On message received'Step 2: Detect intent: scripted vs free-form
Switch node based on message content.
// Switch node:
// Route 1: message matches /pricing|hours|address/ -> static FAQ response
// Route 2: anything else -> LLM-grounded answer pathStep 3: For free-form: search live context via Scavio
HTTP Request node, Scavio /api/v1/search.
// HTTP node: POST https://api.scavio.dev/api/v1/search
// Headers: x-api-key: <key>
// Body: { "query": "{{$json.messages[0].text.body}} site:yourcompany.com" }Step 4: LLM node: ground the answer in Scavio results
Pass top results into the LLM prompt.
// LLM node prompt:
// Answer the user's question using ONLY these sources from our website:
// {{$json.organic_results.slice(0,3).map(r => `- ${r.title}: ${r.snippet} (${r.link})`).join('\n')}}
// Question: {{$node['WhatsApp Trigger'].json.messages[0].text.body}}Step 5: Send LLM answer back to WhatsApp
WhatsApp Send node with the LLM output.
// WhatsApp Send node:
// To: {{$node['WhatsApp Trigger'].json.contacts[0].wa_id}}
// Body: {{$json.choices[0].message.content}}Python Example
# n8n is the deliverable. Per-conversation cost: 2 Scavio calls + 1 LLM call + WA conversation fee = ~$0.03-0.15.JavaScript Example
// n8n nodes are JS-flavored expressions; full TS not needed.Expected Output
Production WhatsApp bot that answers free-form user questions from your live website content, sourced and grounded. Setup time: ~3 hours including Meta Business Account verification (1-3 day external lag).