How onlybot12/project-botweb works
This is a multi-user WhatsApp gateway with a web dashboard and command-driven bot. Users register and authenticate, manage bot connections, pair WhatsApp sessions, configure features, and exchange messages through their bots. Admins manage users, plans, sessions, and broadcasts. The core runtime receives WhatsApp events and dispatches messages to bot behavior, including group tools and media downloads. The excerpts show the main authentication, connection, bot, and persistence links; unsampled dashboard and route internals are represented only where the tree or excerpts support them.
Main entry points: botHandler.js Command handler · whatsapp.js WhatsApp sessions · database.js Database access · admin.js Admin routes
Components 21
Web and accounts
- HTTP server
server.js - Auth routes
routes/auth.js - Token auth
middleware/auth.js - Dashboard UI
views/dashboard - Admin UI
views/admin
WhatsApp connections
- Connection routes
routes/connection.js - Connection routes 2
routes/connection2.js - WhatsApp sessions
utils/whatsapp.js
Bot runtime
- Message dispatch
utils/whatsapp.js - Command handler
utils/botHandler.js - Media downloader
lib/scraper.js - Bot analytics
utils/botAnalytics.js
Administration and state
- Admin routes
routes/admin.js - Database access
utils/database.js - JSON database
database/database.json - Session files
database - Bot and plans config
config.js
Other components
- User
- Admin
- WhatsApp service
- Downloader API
Connections 31
- User → HTTP server: requests pages
- HTTP server → Dashboard UI: renders dashboard
- HTTP server → Admin UI: renders admin
- HTTP server → Auth routes: routes auth
- Auth routes → Database access: reads and writes
- Auth routes → Token auth: protects profile
- Token auth → Database access: loads user
- User → Connection routes: manages connections
- User → Connection routes 2: manages connections
- Connection routes → Token auth: checks token
- Connection routes 2 → Token auth: checks token
- Connection routes → WhatsApp sessions: starts pairing
- Connection routes 2 → WhatsApp sessions: starts or restarts
- WhatsApp sessions → WhatsApp service: opens sessions
- WhatsApp sessions → Session files: reads and saves
- WhatsApp sessions → Database access: updates status
- WhatsApp service → Message dispatch: delivers events
- Message dispatch → Command handler: dispatches messages
- Command handler → Bot analytics: records interactions
- Command handler → Database access: reads and writes
- Command handler → Media downloader: processes downloads
- Media downloader → Downloader API: requests media
- Command handler → WhatsApp service: sends replies
- Admin → Admin routes: manages service
- Admin routes → Token auth: checks token
- Admin routes → Database access: manages records
- Admin routes → WhatsApp sessions: restarts sessions
- Admin routes → WhatsApp service: sends broadcasts
- Database access → JSON database: reads and writes
- Auth routes → Bot and plans config: uses trial limits
- Command handler → Bot and plans config: uses bot settings