AI-powered WhatsApp bot that joins any group, tracks conversations, and generates intelligent summaries.
- 🤖 Automated group chat responses (when mentioned)
- 📝 Smart LLM-based conversation summaries
- 📚 Knowledge base integration for context-aware answers
- 📂 Persistent message history with PostgreSQL +
pgvector - 🔗 Support for multiple message types (text, media, links)
- 👥 Group management & customizable settings
- ⚡ REST API with Swagger docs (
localhost:8000/docs)
- 🐳 Docker and Docker Compose
- 🐍 Python 3.12+
- 🗄️ PostgreSQL with
pgvectorextension - 🔑 Voyage AI API key
- 📲 WhatsApp account for the bot
git clone https://github.com/YOUR_USER/wa_llm.git cd wa_llm
- Copy
.env.exampleto.envand fill in required values.
cp .env.example .env
| Variable | Description | Default |
|---|---|---|
WHATSAPP_HOST |
WhatsApp Web API URL | http://localhost:3000 |
WHATSAPP_BASIC_AUTH_USER |
WhatsApp API user | admin |
WHATSAPP_BASIC_AUTH_PASSWORD |
WhatsApp API password | admin |
VOYAGE_API_KEY |
Voyage AI key | – |
DB_URI |
PostgreSQL URI | postgresql+asyncpg://user:password@localhost:5432/postgres |
LOG_LEVEL |
Log level (DEBUG, INFO, ERROR) |
INFO |
ANTHROPIC_API_KEY |
Anthropic API key. You need to have a real anthropic key here, starts with sk-.... | – |
LOGFIRE_TOKEN |
Logfire monitoring key, You need to have a real logfire key here | – |
docker compose up -d
- Open http://localhost:3000
- Scan the QR code with your WhatsApp mobile app.
- Invite the bot device to any target groups you want to summarize.
- Restart service:
docker compose restart wa_llm-web-server
-
open pgAdmin or any other posgreSQL admin tool
-
connect using
Parameter Value Host localhost Port 5432 Database postgres Username user Password password -
run the following update statement:
UPDATE public."group" SET managed = true WHERE group_name = 'Your Group Name'; -
Restart the service:
docker compose restart wa_llm-web-server
Swagger docs available at: http://localhost:8000/docs
- /load_new_kbtopic (POST) Loads a new knowledge base topic, prepares content for summarization.
- /trigger_summarize_and_send_to_groups (POST) Generates & dispatches summaries, Sends summaries to all managed groups
- install uv tools
uv sync --all-extras --active - run ruff (Python linter and code formatter)
ruff checkandruff format - check for types usage
pyright
- Main application:
app/main.py - WhatsApp client:
src/whatsapp/client.py - Message handler:
src/handler/__init__.py - Database models:
src/models/
The project consists of several key components:
- FastAPI backend for webhook handling
- WhatsApp Web API client for message interaction
- PostgreSQL database with vector storage for knowledge base
- AI-powered message processing and response generation
- Fork the repository
- Create a feature branch
- Submit a pull request