Customer support scaling on WhatsApp can quickly become unmanageable without robust automation. OmniRouter is an enterprise-grade scaffolding that intelligently triages user requests, utilizes LLM-driven knowledge retrieval (RAG), and seamlessly hands off unresolvable queries to human agents.
It is built with a strictly asynchronous architecture to handle high throughput with minimal resource overhead, ensuring sub-second latencies and strict data privacy.
| Feature | Description | Stack |
|---|---|---|
| 🧠 Intelligent Triage | Intent recognition and natural language processing. | OpenAI LangChain |
| 📚 RAG Pipeline | Semantic search across company knowledge bases. | Qdrant Embeddings |
| 🛡️ Privacy-First | Zero-trust PII masking (names, cards, emails) before LLM exposure. | Presidio / Regex |
| 🤝 Human Handoff | Context-aware escalation to live human agents. | Redis Orchestrator |
| 📊 Deep Analytics | Complete traceability, conversation logs, and monitoring. | Prometheus SQLite |
| 🐳 Docker Native | Out-of-the-box containerization for instant deployment. | Docker Compose |
The application leverages a heavily modular design. Webhooks are consumed safely, contextualized against previous state in Redis, analyzed for intent, masked, processed, and responded to.
graph TD
A[WhatsApp API] -->|Webhook Request| B(FastAPI Gateway)
B -->|Signature Validation| C{Security Check}
C -- Valid --> D[Orchestrator Engine]
C -- Invalid --> Z[Drop Request]
D --> E[Session State / Redis]
D --> F[PII Masking Layer]
F --> G{Is Human Handoff?}
G -- Yes --> H[Live Agent Queue]
G -- No --> I[RAG / Qdrant Knowledge Retrieval]
I --> J[OpenAI LLM Generation]
J --> K[Langfuse Tracing]
K --> L[Format Response & Dispatch]
L --> A
D --> M[Prometheus Metrics & Async DB]
The codebase adheres strictly to Domain-Driven Design (DDD), ensuring modular isolation:
whatsapp-orchestrator/
├── pyproject.toml # Python Dependencies (uv/pip)
├── Dockerfile # Container definition for the API
├── docker-compose.yml # Local multi-service orchestration
├── docs/ # Extended documentation (DEPLOYMENT.md)
├── scripts/ # Utility scripts (e.g., seed_knowledge_base.py)
├── src/
│ ├── analytics/ # SQLite async DB, telemetry mapping
│ ├── api/ # FastAPI setup, route declarations
│ ├── bot/ # Redis Session management
│ ├── handoff/ # CCaaS integrations and ticketing logic
│ ├── intelligence/ # LLM processing, semantic search, Langfuse tracking
│ ├── orchestrator/ # Triage engine, failure fallbacks, safety triggers
│ └── utils/ # Helpers: PII masking, cryptographic validation, logging
└── tests/ # Unit & Integration Testing Suite (Pytest)
- Python 3.11+
- Docker & Docker Compose
- Accounts: WhatsApp Business API, OpenAI, Qdrant, Langfuse
Clone the repository and install dependencies:
git clone https://github.com/avuzmal/whatsapp-orchestrator.git
cd whatsapp-orchestrator
pip install -e .[dev]Copy the .env.example to .env (or configure manually) with the required values such as WHATSAPP_VERIFY_TOKEN, OPENAI_API_KEY, and database URLs.
Easily spin up the entire stack using Docker Compose:
docker compose up -d --buildThis will launch:
- FastAPI Server (
localhost:8000) - Redis (
localhost:6379) - Qdrant (
localhost:6333) - PostgreSQL (if configured)
Populate the RAG system with default information:
python scripts/seed_knowledge_base.pyWe maintain a rigorous standard of code quality through a comprehensive test suite.
Run tests locally using pytest:
# Execute unit and integration tests
pytest tests/ -v
# Run with coverage report
pytest tests/ --cov=srcCurrent coverage validates core fallbacks, orchestrator degradation gracefully, PII masking, payload validation, and docker health endpoints.
We provide an infrastructure-agnostic deployment protocol. For production deployment, see our comprehensive Production Deployment Guide.
Highlights include:
infra/docker-compose.prod.ymlfor multi-stage cloud deploys..github/workflows/ci.ymlfor Automated CI/CD.- Container-native resource isolation without running as root.
- Phase 1: Webhook scaffolding, robust core architecture, and fundamental pipelines.
- Phase 2: Full RAG pipeline deployment and advanced LLM chain reasoning.
- Phase 3: Custom Dashboard integrations and comprehensive analytics UI.
Note: This project is maintained independently. All phases are fully complete.