- FAQ
- Introduction
- Comparisons
- Quick Start
- Features
- Disclaimer
- Requirements
- Event Handler
- Command Handler
- Messages
- Chats
- Groups
- Contacts
- Polls
- Channels
- Orders
- Payments
- Multi Device
- Presence and Profile
What Is WWebJS
Setup
Your Application
Components
Business Features
Advanced Topics
Contributing
Decision objective
Use a strategy that matches your runtime constraints:
- low friction local development,
- stable single host production,
- distributed runtime with shared session persistence.
The three strategies
NoAuth
No persistent session. Every restart requires a new login.
Best for:
- quick experiments,
- temporary testing,
- disposable local runs.
LocalAuth
Persists session data in local filesystem, by default under .wwebjs_auth.
Best for:
- local development,
- single machine servers with persistent storage,
- simple production topology.
RemoteAuth
Persists session data through a store adapter in remote storage.
Best for:
- containers and ephemeral hosts,
- multi instance deployments,
- central session management.
Decision logic
- If filesystem is not durable, use
RemoteAuth. - If you run one persistent machine, use
LocalAuth. - If you only test quickly, use
NoAuth.
Minimal examples
NoAuth
const { Client, NoAuth } = require('whatsapp-web.js')
const client = new Client({
authStrategy: new NoAuth(),
})
client.initialize()LocalAuth
const { Client, LocalAuth } = require('whatsapp-web.js')
const client = new Client({
authStrategy: new LocalAuth({
clientId: 'main',
}),
})
client.initialize()RemoteAuth
const { Client, RemoteAuth } = require('whatsapp-web.js')
const { MongoStore } = require('wwebjs-mongo')
const mongoose = require('mongoose')
async function main() {
await mongoose.connect(process.env.MONGODB_URI)
const client = new Client({
authStrategy: new RemoteAuth({
store: new MongoStore({ mongoose }),
clientId: 'main',
backupSyncIntervalMs: 300000,
}),
})
client.initialize()
}
main()Events you should always track
qrauthenticatedauth_failurereadydisconnected- for remote auth, also
remote_session_saved
Without these signals, incident analysis becomes difficult.