Skip to main content

Documentation Index

Fetch the complete documentation index at: https://whiskeysockets-docs-jids-socket-config-ptbr.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Baileys lets you interact with the WhatsApp Web API directly over a WebSocket — no browser, no Selenium, no Chromium. Install it in your Node.js project, authenticate with a QR code or pairing code, and start sending and receiving messages in minutes.

Quick Start

Build and run your first WhatsApp bot in under 5 minutes.

Installation

Add Baileys to your project and check compatibility requirements.

Authentication

Connect your WhatsApp account using QR code or pairing code.

Sending Messages

Send text, media, polls, reactions, and more.

Why Baileys?

Baileys communicates with WhatsApp using the same binary WebSocket protocol as WhatsApp Web — without any browser overhead. This means your bots and integrations use a fraction of the memory of Selenium-based approaches.

Events

Listen for messages, connection changes, and group updates in real time.

Groups

Create groups, manage participants, and configure group settings.

Privacy & Presence

Control privacy settings and subscribe to presence updates.

Advanced Usage

Register custom WebSocket callbacks and extend Baileys functionality.

Get started in 3 steps

1

Install the library

Add Baileys to your Node.js project using your package manager of choice. Install qrcode-terminal too if you want to render the pairing QR in your terminal.
npm install @whiskeysockets/baileys qrcode-terminal
2

Authenticate

Create a socket and scan the QR code with your WhatsApp app to link your account.
import makeWASocket, { useMultiFileAuthState } from '@whiskeysockets/baileys'

import qrcode from 'qrcode-terminal'

const { state, saveCreds } = await useMultiFileAuthState('auth_info')
const sock = makeWASocket({ auth: state })
sock.ev.on('creds.update', saveCreds)
sock.ev.on('connection.update', ({ qr }) => qr && qrcode.generate(qr, { small: true }))
3

Send your first message

Once connected, send a message to any WhatsApp number.
sock.ev.on('connection.update', ({ connection }) => {
  if (connection === 'open') {
    sock.sendMessage('1234567890@s.whatsapp.net', { text: 'Hello from Baileys!' })
  }
})
Baileys is an unofficial library and is not affiliated with WhatsApp. Use it responsibly and in accordance with WhatsApp’s Terms of Service. The maintainers do not condone bulk messaging, spam, or stalkerware use cases.