/ask API. Users message a WhatsApp number, Twilio forwards to your FastAPI server, the bot calls Vaquill, and the answer (with cited sources) returns asynchronously to avoid Twilio’s 15-second timeout. Source code at github.com/Vaquill-AI/integrations/whatsapp-bot.
Features
- Two research modes per user (
standardanddeep) switchable with/mode - Per-user conversation history with configurable session timeout
- Rich slash commands:
/help,/examples,/stats,/mode,/language,/clear,/feedback,/about,/settings - Per-user rate limits (per-minute, per-hour, per-day)
- Phone-number allowlists and blocklists
- Input validation (SQL/XSS/command injection detection, length limits)
- Multi-language replies (en, es, fr, de, pt, ja, ko, zh, ar, hi)
- Optional Redis-backed sessions and rate limits
- Admin endpoints for per-user stats and broadcasts
Prerequisites
Platform setup
WhatsApp does not allow direct bot integrations - you connect through a Business Solution Provider. Twilio is the simplest path: minutes to set up vs weeks for direct WhatsApp Business API access.Sandbox (free, for development)
1
Create a Twilio account
Sign up at twilio.com/try-twilio. Verify your email and phone. When asked for use case, pick Developer or WhatsApp.
2
Grab your credentials
From the Twilio Console dashboard, copy:
- Account SID - starts with
AC(e.g.ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) - Auth Token - click the eye icon to reveal
3
Activate the WhatsApp Sandbox
Console > Messaging > Try it out > Send a WhatsApp message. You will see a sandbox number (typically
+1 (415) 523-8886) and a join code like join brave-tiger. From your personal WhatsApp, send that exact message to the sandbox number. You should receive “You are all set!”.The sandbox number becomes your TWILIO_WHATSAPP_NUMBER, formatted as whatsapp:+14155238886.4
Configure the webhook
On the same page, under Sandbox Configuration > When a message comes in, paste your bot’s webhook URL:
- Local dev:
https://<ngrok-subdomain>.ngrok-free.app/webhook/whatsapp - Production:
https://your-domain.com/webhook/whatsapp
Sandbox limitations: every user must send
join <keyword> first; you can only reply within 24 hours of the user’s last message; the number is shared with other Twilio sandboxes; not suitable for real customers.Production (paid WhatsApp Business sender)
For real customers you need a verified business sender:- Upgrade to a paid Twilio account (trial accounts cannot register WhatsApp senders).
- Console > Messaging > Senders > WhatsApp Senders > Register a WhatsApp Sender.
- Register your business with Meta, submit your WhatsApp Business Profile, get a dedicated number, and submit message templates for approval (required for outbound messages outside the 24-hour window).
- Verification typically takes 2-5 business days.
- Once approved, set
TWILIO_WHATSAPP_NUMBERto your new number.
Quickstart
1
Clone and install
2
Configure
3
Run the bot
4
Tunnel with ngrok (local dev)
In a second terminal:Copy the HTTPS forwarding URL and update the Twilio sandbox webhook to
https://abc123.ngrok-free.app/webhook/whatsapp.Free ngrok URLs change every restart - update Twilio each time. For a stable URL, use a paid ngrok plan or deploy to a cloud host.
5
Test
Send “Hi” to the sandbox number to get a welcome message, then ask:
Configuration
The most-used env vars. Full list in the repo.env.example.
Commands
Any non-slash message is treated as a legal question.
Deployment
Docker
Cloud hosts
Render
New Web Service. Build:
pip install -r requirements.txt. Start: python bot.py. Free tier cold-starts in 30-60s - keep warm with an uptime monitor.Railway
Auto-detects Python. Add env vars under Variables, get a
.up.railway.app URL.Fly.io
fly launch, fly secrets set ..., fly deploy. Global low-latency regions.VPS
Run uvicorn behind nginx + Let’s Encrypt for TLS.
https://your-domain.com/webhook/whatsapp (POST).
Troubleshooting
Quick connectivity test:
Related
Telegram
No business-verification overhead.
Signal
Privacy-first messenger alternative.
Chatbots overview
Compare all six platforms.
Authentication
How Vaquill API keys work.

