Production-ready WhatsApp lead automation system with AI qualification, human handoff, and executive dashboard.
Customer
↓
WhatsApp (via WAHA)
↓
HTTPS Webhook
↓
Webhook Verification
↓
Event Normalization
↓
Idempotency
↓
Event Persistence
↓
CRM
↓
AI Orchestration
├── Intent Detection
├── Context Retrieval
├── Qualification
├── Confidence Scoring
└── Human Handoff
↓
Decision Engine
↓
Actions
├── WhatsApp Response
├── CRM Update
├── Follow-up
└── Booking
↓
Verification
↓
Audit/Event Log
↓
Analytics / CEO Dashboard
- Python 3.11+
- PostgreSQL
- WAHA (WhatsApp HTTP API) or WhatsApp Business API credentials
- AI API endpoint (OpenAI-compatible)
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python main.py| Variable | Required | Description |
|---|---|---|
AI_BASE_URL |
Yes | AI API base URL |
AI_API_KEY |
Yes | AI API key |
DATABASE_URL |
Yes | PostgreSQL connection string |
WAHA_BASE_URL |
No | WAHA instance URL (e.g., http://localhost:3000) |
WAHA_SESSION |
No | WAHA session name (default: default) |
WAHA_API_KEY |
No | WAHA API key |
WAHA_WEBHOOK_SECRET |
No | Webhook verification secret |
WHATSAPP_ACCESS_TOKEN |
No | Direct WhatsApp API token |
WHATSAPP_PHONE_NUMBER_ID |
No | Direct WhatsApp phone ID |
See render.yaml for service configuration. Deploy with:
- Push code to GitHub
- Connect repository to Render
- Render will create
automation-workerandwahaservices - Set environment variables in Render dashboard
Run schema.sql against your PostgreSQL instance:
psql -U app -d massagevip -f schema.sql# Unit and integration tests
python3 test_integration.py
# Smoke test (requires live WAHA instance)
python3 smoke_test.py- Go-live checklist:
GOLIVE.md - Cron schedule:
CRON.md - Schema:
schema.sql
