Skip to main content

Welcome to Baileys

Baileys is a lightweight, efficient TypeScript library that lets you interact with WhatsApp Web through WebSockets - no Selenium, no Chromium, and no heavy browser automation.

Why choose Baileys?

Baileys directly interfaces with WhatsApp Web using WebSockets, making it significantly more efficient than browser-based automation tools.

Memory efficient

No Selenium or Chromium means you save approximately 500MB of RAM per instance

Multi-device support

Works seamlessly with WhatsApp’s multi-device architecture

TypeScript first

Fully typed API with excellent IntelliSense support for better developer experience

Production ready

Battle-tested library used by developers worldwide with active community support

Key features

Authentication methods

Connect to WhatsApp using either QR code scanning or pairing codes - both methods support WhatsApp’s multi-device functionality.

Comprehensive messaging

Send and receive all message types including text, media (images, videos, audio), documents, locations, contacts, polls, reactions, and more.

Full API coverage

Manage groups, handle privacy settings, work with broadcast lists, modify chats, query user information, and access nearly every feature available in WhatsApp Web.

Event-driven architecture

Use EventEmitter patterns to handle messages, connection updates, presence changes, and all WhatsApp events with strongly-typed event handlers.

Quick example

Here’s what it takes to connect and send a message:
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@whiskeysockets/baileys'

const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')

const sock = makeWASocket({
  auth: state
})

sock.ev.on('connection.update', (update) => {
  const { qr } = update
  if(qr) {
    console.log('QR Code:', qr)
    // Use qrcode-terminal or display QR in your preferred way
  }
})

sock.ev.on('creds.update', saveCreds)

sock.ev.on('messages.upsert', async ({ messages }) => {
  const message = messages[0]
  if (!message.key.fromMe) {
    await sock.sendMessage(message.key.remoteJid!, { 
      text: 'Hello! Message received.' 
    })
  }
})

Get started

Installation

Install Baileys using npm, yarn, or pnpm

Quick start

Get your first WhatsApp bot running in minutes

Migration guide

Upgrading from an older version? Check the migration guide

API reference

Explore the complete API documentation

Community and support

Join the Discord community at discord.gg/WeJM5FP9GG for help, discussions, and updates.

Credits

Baileys builds upon the work of several researchers and developers:
  • @pokearaujo for documenting WhatsApp Multi-Device
  • @Sigalor for WhatsApp Web reverse engineering
  • @Rhymen for the Go implementation

Important disclaimer

This project is not affiliated with WhatsApp or Meta. Use responsibly and in accordance with WhatsApp’s Terms of Service. The maintainers do not condone spam, bulk messaging, or any practices that violate WhatsApp’s policies.
Baileys is licensed under MIT. See the GitHub repository for more information.

Build docs developers (and LLMs) love