makeWASocket with a SocketConfig object. Most options have sensible defaults defined in DEFAULT_CONNECTION_CONFIG, so you only need to provide the ones that matter for your use case. This page walks through every option you are likely to configure in a real application.
Required options
auth
The only truly required field. You must pass an AuthenticationState object containing your credentials and Signal key store. Use useMultiFileAuthState to load credentials from disk during development, and replace it with a database-backed implementation for production.
Identity and browser
browser
Controls how Baileys identifies itself to WhatsApp. The type is WABrowserDescription, which is a [platform, browserName, version] tuple. Use the Browsers constant instead of writing the tuple manually — this is also the name that appears in WhatsApp’s Linked Devices list.
The browser you choose also affects how much history WhatsApp sends on first sync. Desktop identities (macOS or Windows) receive significantly more history than mobile ones.
Receiving full message history
By default, Baileys connects with a Chrome browser profile, which limits how much history WhatsApp delivers on the initial sync.syncFullHistory is already true by default — the key step is switching the browser preset to Browsers.macOS('Desktop'), which WhatsApp treats as a desktop client eligible for extended history.
messaging-history.set event after the connection opens. See Sync chat history for details on consuming the payload.
Requesting full history can significantly increase startup time and memory usage on accounts with large chat histories.
logger
Accepts any pino-compatible logger. Pass a logger with level: 'debug' to see every binary frame Baileys sends and receives — useful when debugging protocol issues.
Connection behavior
markOnlineOnConnect
Default: true
When true, Baileys marks itself as an online/active client the moment the socket connects. WhatsApp treats an active web session as a foreground device, so the primary phone stops sending push notifications.
Set this to false if you want the phone to continue receiving notifications while your bot or integration runs in the background.
syncFullHistory
Default: true
Requests the phone to deliver the full chat history on first connection. This is delivered asynchronously via the messaging-history.set event. Full history syncs can be large; if you only need recent messages, set this to false.
printQRInTerminal
Message reliability
getMessage
A callback that takes a WAMessageKey and returns the corresponding proto.IMessage (or undefined). Baileys calls this in two situations:
- Message retries — when a message fails to decrypt on the first attempt, Baileys requests a resend. It needs the original plaintext to re-encrypt it.
- Poll vote decryption —
messages.updateevents for polls require the original poll creation message to aggregate votes.
msgRetryCounterCache
A CacheStore used to count how many times Baileys has retried sending a specific message. This prevents infinite retry loops. Use a NodeCache instance (from @cacheable/node-cache) or any object that satisfies the CacheStore interface.
startSock function so the retry counts survive socket restarts.
maxMsgRetryCount
Default: 5
The maximum number of times Baileys will retry sending a failed message before giving up. Increase this only if you operate in unreliable network conditions.
Group performance
cachedGroupMetadata
A callback that returns cached GroupMetadata for a given JID, or undefined to trigger a live fetch. Every message sent to a group requires the group’s participant list to build Signal sender-key sessions. Without a cache, this triggers a network request for every message.
Filtering events
shouldIgnoreJid
A predicate that receives a JID string and returns true to suppress all events and message decryption for that JID. Use this to skip broadcast lists, newsletters, or specific contacts you do not care about.
Timeouts and keep-alive
Link previews
generateHighQualityLinkPreview
Default: false
When true, Baileys uploads the link preview thumbnail to WhatsApp’s media servers so recipients see a high-resolution image. This requires link-preview-js to be installed.