Overview
TheBrowsers constant provides predefined browser configurations for WhatsApp Web connections. Different browser configurations can affect the connection behavior, message history sync, and device identification.
Type Definition
WABrowserDescription tuple: [OS, Browser, Version]
Available Configurations
Browsers.ubuntu()
string
required
The browser name to use (e.g., ‘Chrome’, ‘Firefox’, ‘MyApp’).
[string, string, string]
Returns
['Ubuntu', browser, '22.04.4']Browsers.macOS()
string
required
The browser name to use (e.g., ‘Safari’, ‘Chrome’, ‘Desktop’).
[string, string, string]
Returns
['Mac OS', browser, '14.4.1']Browsers.baileys()
string
required
The browser/app name to use (e.g., ‘MyApp’, ‘Bot’).
[string, string, string]
Returns
['Baileys', browser, '6.5.0']Browsers.windows()
string
required
The browser name to use (e.g., ‘Edge’, ‘Chrome’).
[string, string, string]
Returns
['Windows', browser, '10.0.22631']Browsers.appropriate()
string
required
The browser name to use.
[string, string, string]
Returns browser configuration based on your current operating system and release version.
Platform Mapping
Theappropriate() function uses the following platform detection:
getPlatformId()
Utility function to get the platform ID for a given browser string.string
required
The browser name (case-insensitive).
string
Returns the platform type ID. Defaults to ‘1’ (Chrome) if not found.
Usage Examples
QR Code Connection with Custom Browser
Desktop Configuration for Full History
To receive more message history, use a desktop configuration:Dynamic Browser Selection
Pairing Code with Custom Name
Browser Configuration Impact
Message History
Different browser configurations can affect how much message history you receive:- Desktop configurations (e.g.,
Browsers.macOS('Desktop')) typically receive more history - Mobile-like configurations may receive less history
- Combined with
syncFullHistory: truefor maximum history sync
Device Identification
The browser configuration is visible in WhatsApp’s “Linked Devices” section:Default Configuration
When not specified, Baileys uses:Complete Example
Best Practices
-
Use descriptive names: Choose browser names that identify your application
-
Match your deployment: Use
appropriate()for automatic OS detection -
Desktop for history: Use desktop configurations when full history is needed
-
Consistent branding: Keep the same browser name across reconnections
Source Code Reference
Fromsrc/Utils/browser-utils.ts:19-26:
See Also
- makeWASocket - Main socket creation function
- SocketConfig - Complete socket configuration
- WABrowserDescription Type - Type definition