Documentation Index
Fetch the complete documentation index at: https://mintlify.com/whiskeysockets/Baileys/llms.txt
Use this file to discover all available pages before exploring further.
Overview
QR code authentication is the primary method for connecting Baileys to WhatsApp. Your phone scans the QR code displayed by Baileys, establishing a multi-device connection.Basic QR Code Connection
The simplest way to connect with a QR code:When
printQRInTerminal is set to true, the QR code will be displayed in your terminal for easy scanning.Browser Configuration
You can customize the browser identity that appears in your WhatsApp’s “Linked Devices” section using thebrowser parameter.
Available Browser Configs
Baileys provides predefined browser configurations:Browser Configuration Options
| Browser | Platform | Version |
|---|---|---|
Browsers.ubuntu() | Ubuntu | 22.04.4 |
Browsers.macOS() | Mac OS | 14.4.1 |
Browsers.windows() | Windows | 10.0.22631 |
Browsers.baileys() | Baileys | 6.5.0 |
Browsers.appropriate() | Auto-detected | System release |
Custom Browser Configuration
You can also provide a custom browser configuration:[Platform, AppName, Version]
Receiving Full Message History
To receive complete message history when connecting, configure these options:Use Desktop Browser
Desktop browsers (macOS, Windows, Ubuntu) receive more message history than mobile browsers.
Complete Connection Example
Here’s a complete example with QR code authentication and session persistence:QR Code Timeout
You can configure how long to wait for QR code generation:Connection Events
Monitor the QR code and connection status:Best Practices
Choose the Right Browser Config
Use desktop browser configs (
macOS, windows, ubuntu) to receive more message history.Save Authentication State
Always use
useMultiFileAuthState to save sessions and avoid repeated QR scanning.Handle Reconnections
Implement automatic reconnection logic for network failures (but not for logout).
Next Steps
Session Management
Learn how to save and restore sessions
Pairing Code Method
Alternative authentication without QR codes
Handling Events
Process messages and connection events
Socket Configuration
Advanced socket configuration options