How punith-bot/whatsapp-ai-bot works
WhatsApp AI Bot receives contact messages through its WhatsApp client, routes them through message handling and per-contact throttling, and replies using AI with conversation context, document parsing, or web search as appropriate. SQLite stores contacts, settings, and conversation state; a local dashboard controls the bot and connection, while bot profiles and scheduling add autonomous behavior. The runtime and desktop shell provide startup and lifecycle management. Some capabilities are documented but their implementation was not sampled; those links are omitted where ownership is uncertain.
Main entry points: server.js Dashboard API · handler.js Message Handler · bot.js WhatsApp Client · runtime.js Runtime Lifecycle
Components 20
Runtime & Desktop
- CLI Entry
index.js - Desktop Shell
desktop/main.js - Runtime Lifecycle
src/runtime.js - Environment Config
src/config.js - Desktop Preload
desktop/preload.js
WhatsApp Messaging
- WhatsApp Client
src/bot.js - Message Handler
src/handler.js - Contact Queue
src/queue.js - Profiles & Scheduling
src/bot-mode.js
AI & Content
- AI Reply Engine
src/ai.js - Document Parsing
src/documents.js - Search Detection
src/search.js
Data & State
- SQLite Store
src/database.js
Dashboard & Controls
- Dashboard API
src/server.js - Live Events & QR
src/socket.js - Dashboard UI
dashboard/app.js
Other components
- Owner
- WhatsApp Contact
- Groq API
Connections 33
- CLI Entry → Runtime Lifecycle: starts
index.js - Desktop Shell → Runtime Lifecycle: starts
desktop/main.js - Runtime Lifecycle → Environment Config: validates
src/runtime.js - Runtime Lifecycle → SQLite Store: loads
src/runtime.js - Runtime Lifecycle → Dashboard API: loads
src/runtime.js - Runtime Lifecycle → WhatsApp Client: loads
src/runtime.js - WhatsApp Contact → WhatsApp: sends messages
README.md - WhatsApp → WhatsApp Client: delivers messages
README.md - WhatsApp Client → Message Handler: routes messages
src/bot.js - Message Handler → Contact Queue: enqueues work
src/handler.js - Message Handler → Profiles & Scheduling: parses instructions
src/handler.js - Message Handler → SQLite Store: reads and writes
src/handler.js - Message Handler → Document Parsing: parses attachments
src/handler.js - Message Handler → AI Reply Engine: generates replies
src/handler.js - AI Reply Engine → Search Detection: checks search need
src/ai.js - AI Reply Engine → SQLite Store: reads config
src/ai.js - AI Reply Engine → Groq API: requests completions
README.md - Message Handler → WhatsApp Client: sends replies
src/handler.js - WhatsApp Client → SQLite Store: syncs contacts
src/bot.js - WhatsApp Client → Live Events & QR: emits status
src/bot.js - Profiles & Scheduling → SQLite Store: manages profiles
src/bot-mode.js - Profiles & Scheduling → AI Reply Engine: generates proposals
src/bot-mode.js - Profiles & Scheduling → Live Events & QR: emits updates
src/bot-mode.js - Dashboard API → SQLite Store: serves data
src/server.js - Dashboard API → Profiles & Scheduling: serves controls
src/server.js - Dashboard API → WhatsApp Client: resets session
src/server.js - Dashboard API → Live Events & QR: configures events
src/socket.js - Dashboard API → AI Reply Engine: serves AI settings
src/server.js - Owner → Dashboard UI: uses controls
README.md - Dashboard UI → Dashboard API: calls API
README.md - Dashboard API → Dashboard UI: serves dashboard
src/server.js - Live Events & QR → Dashboard UI: streams events
src/socket.js - Desktop Shell → Desktop Preload: exposes bridge
desktop/main.js