npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@towartz/baileys

v7.0.0-rc.9

Published

A WebSockets library for interacting with WhatsApp Web

Readme

npm version npm downloads license


Features

  • LID/JID Resolution — Full Linked ID ↔ Phone Number conversion with 120+ BOT_MAP entries
  • Interactive Buttons — Send buttons, list messages, and native flow messages
  • WhatsApp Status — Send stories/status with full wrapper support
  • Group Status V2 — Advanced group status messaging
  • Event Invitations — Send event invite messages
  • Advanced Polls — Polls with end time, hidden voters, and add-option support
  • Read Receipt Control — Block/manage read receipts globally
  • Post-Quantum Crypto — Latest handshake modes (XXKEM, IKKEM, etc.)
  • Bot Integration — Full bot metadata, commands, and group bot support
  • Mutex Auth — Thread-safe authentication (PQueue → Mutex migration)
  • Stream History — Efficient history sync via stream pipeline

Install

npm install @towartz/baileys
# or
yarn add @towartz/baileys
# or
pnpm add @towartz/baileys

Requires Node.js >= 20.0.0

Quick Start

Connect with QR Code

import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@towartz/baileys'
import { Boom } from '@hapi/boom'

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

const sock = makeWASocket({
    auth: state,
    printQRInTerminal: true
})

sock.ev.on('connection.update', (update) => {
    const { connection, lastDisconnect } = update
    if (connection === 'close') {
        const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
        if (shouldReconnect) connectToWhatsApp()
    } else if (connection === 'open') {
        console.log('Connected!')
    }
})

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

sock.ev.on('messages.upsert', async ({ messages }) => {
    for (const m of messages) {
        if (m.key.fromMe) continue
        await sock.sendMessage(m.key.remoteJid!, { text: 'Hello!' })
    }
})

Connect with Pairing Code

const sock = makeWASocket({
    auth: state,
    printQRInTerminal: false
})

if (!sock.authState.creds.registered) {
    const code = await sock.requestPairingCode('6281234567890')
    console.log('Pairing code:', code)
}

Extended Features

Interactive Buttons

// Using sendButtons helper
await sock.sendButtons(jid, 'Choose an option:', [
    { id: 'btn1', text: 'Button 1' },
    { id: 'btn2', text: 'Button 2' },
    { id: 'btn3', text: 'Button 3' }
])

// Or via sendMessage
await sock.sendMessage(jid, {
    text: 'Choose an option:',
    footer: 'Powered by Estella Baileys',
    buttons: [
        { buttonId: 'btn1', buttonText: { displayText: 'Option 1' }, type: 1 },
        { buttonId: 'btn2', buttonText: { displayText: 'Option 2' }, type: 1 }
    ],
    headerType: 1
})

List Message

await sock.sendListMessage(jid, {
    title: 'Menu List',
    body: 'Select an option below',
    footerText: 'Estella Baileys',
    buttonText: 'Tap Here',
    sections: [
        {
            title: 'Main Menu',
            rows: [
                { title: 'Feature 1', description: 'Description 1', rowId: 'feat1' },
                { title: 'Feature 2', description: 'Description 2', rowId: 'feat2' }
            ]
        }
    ]
})

Send WhatsApp Status

// Text status
await sock.sendStatus(jid, 'status@broadcast', {
    text: 'My status update!',
    backgroundColor: '#0000FF',
    font: 1
})

// Image status
await sock.sendStatus(jid, 'status@broadcast', {
    image: { url: './image.jpg' },
    caption: 'My photo status'
})

Block Read Receipts

import { setAuroraBlockReadReceipts } from '@towartz/baileys'

// Enable — no one will see you read their messages
setAuroraBlockReadReceipts(true)

// Disable
setAuroraBlockReadReceipts(false)

LID/JID Utilities

import { lidToJid, jidToLid, getBotJid, isJidUser } from '@towartz/baileys'

// Convert LID to phone JID
const phoneJid = lidToJid('1234567890@lid')
// → '[email protected]'

// Convert phone JID to LID
const lidJid = jidToLid('[email protected]')
// → '1234567890@lid'

// Check if valid user JID
isJidUser('[email protected]') // true

Advanced Poll

await sock.sendMessage(jid, {
    poll: {
        name: 'What is your favorite color?',
        values: ['Red', 'Blue', 'Green'],
        selectableCount: 1,
        // Extended options
        endTime: Math.floor(Date.now() / 1000) + 86400, // 24 hours
        hideParticipantName: true,
        allowAddOption: true
    }
})

Event Invitation

await sock.sendMessage(jid, {
    eventInvite: {
        eventId: 'event_123',
        eventTitle: 'My Event',
        startTime: Math.floor(Date.now() / 1000) + 3600,
        caption: 'Join my event!',
        jpegThumbnail: Buffer.from('...'),
        isCanceled: false
    }
})

Common Usage

Sending Messages

// Text
await sock.sendMessage(jid, { text: 'Hello!' })

// Image
await sock.sendMessage(jid, {
    image: { url: './photo.jpg' },
    caption: 'Check this out!'
})

// Video
await sock.sendMessage(jid, {
    video: { url: './video.mp4' },
    caption: 'Watch this',
    gifPlayback: false
})

// Audio
await sock.sendMessage(jid, {
    audio: { url: './song.mp3' },
    mimetype: 'audio/mp4'
})

// Document
await sock.sendMessage(jid, {
    document: { url: './file.pdf' },
    mimetype: 'application/pdf',
    fileName: 'document.pdf'
})

// Location
await sock.sendMessage(jid, {
    location: {
        degreesLatitude: -6.2088,
        degreesLongitude: 106.8456
    }
})

// Contact
await sock.sendMessage(jid, {
    contacts: {
        displayName: 'John Doe',
        contacts: [{ vcard: 'BEGIN:VCARD\n...' }]
    }
})

// Reaction
await sock.sendMessage(jid, {
    react: { text: '❤️', key: message.key }
})

Group Management

// Create group
const group = await sock.groupCreate('My Group', ['[email protected]'])

// Add/Remove participants
await sock.groupParticipantsUpdate(jid, ['[email protected]'], 'add')

// Promote/Demote admin
await sock.groupParticipantsUpdate(jid, ['[email protected]'], 'promote')

// Change group name
await sock.groupUpdateSubject(jid, 'New Name')

// Change group description
await sock.groupUpdateDescription(jid, 'New description')

// Get invite link
const code = await sock.groupInviteCode(jid)

Privacy

// Block/Unblock
await sock.updateBlockStatus(jid, 'block')
await sock.updateBlockStatus(jid, 'unblock')

// Privacy settings
await sock.updateLastSeenPrivacy('all')
await sock.updateOnlinePrivacy('all')
await sock.updateProfilePicturePrivacy('contacts')

API Reference

| Feature | Import | Description | |---------|--------|-------------| | makeWASocket | @towartz/baileys | Create WhatsApp socket | | useMultiFileAuthState | @towartz/baileys | Multi-file auth state | | sendButtons | @towartz/baileys | Send interactive buttons | | sendListMessage | @towartz/baileys | Send list message | | sendStatus | @towartz/baileys | Send WhatsApp status | | setAuroraBlockReadReceipts | @towartz/baileys | Toggle read receipt blocking | | lidToJid | @towartz/baileys | Convert LID to phone JID | | jidToLid | @towartz/baileys | Convert phone JID to LID | | getBotJid | @towartz/baileys | Resolve bot JID | | downloadMediaMessage | @towartz/baileys | Download media from message | | getContentType | @towartz/baileys | Get message content type | | getDevice | @towartz/baileys | Get sender device info |

Project Structure

src/
├── patch/
│   ├── wileys-patch.ts          # LID/JID resolution
│   ├── wileys-utils.ts          # Utility functions
│   ├── make-in-memory-store.ts  # In-memory store
│   ├── status-patch.ts          # Status sending
│   ├── group-status-patch.ts    # Group status V2
│   ├── interactive-buttons.ts   # Buttons & lists
│   ├── read-receipt-guard.ts    # Read receipt control
│   └── wileys-compat-patch.ts   # Runtime compatibility
├── utils/
│   └── jid.ts                   # JID utilities
├── make-wa-socket.ts            # Socket factory
├── baileys-compat.ts            # Baileys compatibility
└── plugin-compat.ts             # Plugin layer

Changelog

v10

  • WAProto refresh to 2.3000.1036692702
  • Full LID/JID resolution system with 120+ BOT_MAP entries
  • MEX notification modernization (15+ notification types)
  • normalizeMessageContent: 5 → 23 wrappers
  • Interactive buttons, list messages, native flow
  • Event invitation messages
  • Advanced poll support (endTime, hideVoters, addOption)
  • Post-quantum handshake modes
  • PQueue → Mutex migration for thread safety
  • Stream-based history inflation
  • Read receipt blocking
  • Status & Group Status V2 sending
  • Bot metadata, commands, and group bot support

Disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or affiliates.

The maintainers do not condone the use of this application in practices that violate the Terms of Service of WhatsApp. Use at your own discretion. Do not spam people. We discourage any stalkerware, bulk or automated messaging usage.

License

MIT — Copyright (c) 2025 Towartz