SocketConfig
Complete configuration object formakeWASocket().
Connection Settings
string | URL
required
The WebSocket URL to connect to WhatsApp serversDefault:
'wss://web.whatsapp.com/ws/chat'number
required
Connection timeout in milliseconds. Fails if socket doesn’t connect within this time.Default:
20000 (20 seconds)number | undefined
required
Default timeout for queries in milliseconds.
undefined for no timeout.Default: 60000 (60 seconds)number
required
Ping-pong interval for WebSocket connection in millisecondsDefault:
25000 (25 seconds)Agent
Proxy agent for WebSocket connection
Agent
Agent used for HTTP fetch requests (uploading/downloading media)
Client Identification
WAVersion
required
WhatsApp Web version to connect withType:
[number, number, number]Example: [2, 2323, 4]WABrowserDescription
required
Browser identification sent to WhatsAppType:
[string, string, string]Example: ['Baileys', 'Chrome', '1.0.0']string
required
Alphanumeric country code for the number (e.g., ‘US’, ‘BR’, ‘IN’)
Authentication
AuthenticationState
required
Authentication state object containing credentials and keysSee AuthenticationState
TransactionCapabilityOptions
required
Options for SignalKeyStore transaction capability
Logging and Events
ILogger
required
Logger instance for debug output
boolean
required
Whether to emit events for actions done by this socket connectionDefault:
trueHistory and Sync
boolean
required
Whether to ask the phone for full history (received asynchronously)Default:
falsefunction
required
Control which history messages to syncReturn
true to sync, false to skipboolean
required
Whether to automatically fire initialization queriesDefault:
trueMessage Handling
function
required
Fetch a message from your store for retry logicRequired for handling “this message can take a while” issues
function
required
Optionally modify messages before sending
function
required
Determine if a JID should be ignored (no events, no decryption)
Media
MediaConnInfo['hosts']
required
Custom upload hosts for media
number
required
Width for link preview images in pixelsDefault:
192boolean
required
Generate high quality link previews (uploads jpegThumbnail to WhatsApp)Default:
falseRetry and Error Handling
number
required
Time to wait between sending retry requests in millisecondsDefault:
250number
required
Maximum retry count for messagesDefault:
5number
Time to wait for QR code generation in millisecondsDefault:
60000 (60 seconds)boolean
required
Enable automatic session recreation for failed messagesDefault:
falseboolean
required
Enable recent message caching for retry handlingDefault:
falseCaching
CacheStore
Cache to store media to avoid re-uploadingSee CacheStore
CacheStore
Cache to track retry counts for failed messages
PossiblyExtendedCacheStore
Cache to store user device lists
CacheStore
Cache to store call offers
CacheStore
Cache to track placeholder resends
function
required
Fetch cached group metadata to speed up message sending
Advanced
boolean
required
Mark client as online when socket connectsDefault:
trueobject
required
Verify app state MACs
RequestInit
required
Options for HTTP fetch requests
function
required
Factory function for creating signal repositories
CacheStore
Interface for cache implementations used throughout Baileys.function
required
Get a cached key
function
required
Set a key in the cache
function
required
Delete a key from the cache
function
required
Flush all data from cache
PossiblyExtendedCacheStore
Extended cache store with batch operations:function
Get multiple keys at once
function
Set multiple keys at once
function
Delete multiple keys at once