Skip to main content

Overview

makeWASocket is the primary function used to create a WhatsApp Web socket connection. It accepts a configuration object and returns a socket instance with all methods for interacting with the WhatsApp Web API.

Function Signature

Parameters

UserFacingSocketConfig
required
Configuration object for the socket connection. This is a combination of Partial<SocketConfig> with a required auth property.

Return Value

WASocket
Returns a socket instance with all methods for interacting with the WhatsApp Web API, including:
  • Message sending and receiving
  • Group management
  • Contact management
  • Media handling
  • Event listeners
  • And more

Basic Example

Advanced Example with Caching

Pairing Code Example

Implementation Details

The makeWASocket function internally:
  1. Merges the provided config with DEFAULT_CONNECTION_CONFIG
  2. Creates a socket through the makeCommunitiesSocket layer
  3. Returns the fully configured socket instance

See Also

  • SocketConfig - Complete socket configuration reference
  • Browsers - Browser configuration options
  • Events - Available socket events