How toshniwalpranav/whatsgateway-typescript-nextjs works
WA-AKG is a multi-session WhatsApp gateway with a web dashboard for messaging and automation. A user or integrating app manages a session through the dashboard or REST API; API handlers authorize requests and dispatch WhatsApp operations, while session management maintains Baileys connections and persistence. The README also documents scheduled messaging, broadcasts, auto-replies, webhooks, contacts, stickers, and MCP integration. The graph preserves these major capabilities, but several are connected only where the README or indexed source references support the relationship; unsampled implementation details are not inferred.
Main entry points: manager.ts Session Manager · api REST API · prisma.ts Prisma Database · index.ts HTTP / Socket Server
Components 27
Dashboard Experience
- Dashboard
src/app/dashboard - Chat Interface
src/components/chat/chat-window.tsx - Chat Actions
src/app/dashboard/chat/actions.ts - Session Manager UI
src/components/dashboard/session-manager.tsx
Gateway API
- REST API
src/app/api - MCP API
src/app/mcp - Webhook API
src/app/api/webhooks/route.ts
WhatsApp Runtime
- Session Manager
src/modules/whatsapp/manager.ts - WhatsApp Instance
src/modules/whatsapp/instance.ts - Chat Service
src/modules/whatsapp/chat.service.ts - Contact Management
src/modules/whatsapp/store/contacts.ts - Sticker Tools
src/app/api/messages/[sessionId]/[jid]/sticker/route.ts
Automation Integrations
- MCP Integration
src/lib/mcp.ts - Message Scheduler
src/modules/whatsapp/scheduler.ts - Auto Broadcast
src/modules/whatsapp/auto-broadcast.ts - Auto Replies
src/modules/whatsapp/store/autoreply.ts - Bot Commands
src/modules/whatsapp/bot/command-handler.ts - Webhook Delivery
src/lib/webhook.ts
Platform Services
- API Authorization
src/lib/api-auth.ts - Prisma Database
src/lib/prisma.ts - Plan & Quota
src/lib/rate-limit.ts - Web Authentication
src/lib/auth.ts - HTTP / Socket Server
src/server/index.ts - Socket Client
src/lib/socket-client.ts
Other components
- User / App
- External CRM / API
Connections 32
- User / App → Dashboard: uses
README.md - User / App → REST API: calls REST
README.md - Dashboard → Chat Interface: opens chat
src/components/chat/chat-window.tsx - Chat Interface → Chat Actions: uses actions
src/components/chat/chat-window.tsx - Session Manager UI → Socket Client: creates socket
src/components/dashboard/session-manager.tsx - REST API → API Authorization: authorizes requests
src/app/api/media/route.ts - API Authorization → Web Authentication: checks session
src/lib/api-auth.ts - API Authorization → Prisma Database: reads access
src/lib/api-auth.ts - REST API → Prisma Database: reads and writes
src/app/api/media/route.ts - REST API → Plan & Quota: enforces quota
src/app/api/jpm-swgc/[sessionId]/route.ts - REST API → Session Manager: dispatches WhatsApp
src/app/api/jpm-swgc/[sessionId]/route.ts - REST API → WhatsApp: uses Baileys
README.md - Session Manager → WhatsApp Instance: creates instances
src/modules/whatsapp/manager.ts - Session Manager → Prisma Database: persists sessions
src/modules/whatsapp/manager.ts - WhatsApp Instance → WhatsApp: connects
README.md - Chat Actions → Chat Service: delegates chat
- Chat Service → Session Manager: gets instance
src/modules/whatsapp/chat.service.ts - MCP API → MCP Integration: routes messages
src/app/mcp/route.ts - Message Scheduler → Session Manager: scheduled dispatch
- Auto Broadcast → Session Manager: broadcast dispatch
- Auto Replies → WhatsApp: replies automatically
- Bot Commands → WhatsApp: handles commands
- Webhook API → Prisma Database: stores registrations
src/app/api/webhooks/route.ts - Webhook Delivery → External CRM / API: forwards events
README.md - WhatsApp → Webhook Delivery: sends events
README.md - Contact Management → Prisma Database: stores contacts
- Sticker Tools → WhatsApp: sends stickers
- HTTP / Socket Server → Session Manager: initializes sessions
src/server/index.ts - HTTP / Socket Server → Message Scheduler: starts scheduler
src/server/index.ts - HTTP / Socket Server → Auto Broadcast: starts broadcast
src/server/index.ts - Socket Client → HTTP / Socket Server: connects realtime
- Session Manager → Prisma Database: loads sessions
src/modules/whatsapp/manager.ts