Skip to main content

Overview

The Browsers 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

Each function returns a 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

The appropriate() 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: true for 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

  1. Use descriptive names: Choose browser names that identify your application
  2. Match your deployment: Use appropriate() for automatic OS detection
  3. Desktop for history: Use desktop configurations when full history is needed
  4. Consistent branding: Keep the same browser name across reconnections

Source Code Reference

From src/Utils/browser-utils.ts:19-26:

See Also