A multi-session WhatsApp library with MongoDB session storage, built on Baileys. v3.11.1 (Jul 2024) uses MongoDB for scalable auth/session persistence, auto-loads sessions at startup, supports QR scan only once per device, and includes auto-reconnect, group chat detection, message deletion, custom browser config, proxy support, and media download. Differentiates from file-based alternatives by using MongoDB for better scalability and session management. TypeScript types included.
npm install wa-multi-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes MongoDB connection, starts a WhatsApp session with QR code, and sends a text message.
Replace getConnectionState() with event listeners (session.events.on('connection.update', ...)).Wrap startSession() in try/catch to handle connection errors properly.
Always call await whatsapp.setMongoURI(uri) before any session operations.
Use the default collection names unless you have a specific reason; avoid relying on custom names.
Test proxy thoroughly; prefer HTTP/HTTPS proxies over SOCKS. Set proxy via startSession options.
Check MongoDB connection string, ensure MongoDB is running, and network allows access.
Use: import * as whatsapp from 'wa-multi-mongodb' or import { startSession } from 'wa-multi-mongodb'Call await whatsapp.setMongoURI(process.env.MONGODB_URI) before any session operation.
Ensure both packages are compatible; stick to versions specified in peerDependencies.