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

xnxx-bail-pro

v2.1.0

Published

WhatsApp Web API client with interactive messages, product catalogs, carousels, events, payments, and polls. Forked from WhiskeySockets/Baileys.

Downloads

247

Readme

🔥 XNXX Bail Pro


Tech Stack


Features Overview

Why Choose XNXX Bail Pro?

Core Features

| Feature | Description | |---------|-------------| | Multi-Device Support | Connect without phone always online | | WebSocket Based | Fast and efficient real-time communication | | Session Management | Save and restore authentication state | | Auto Reconnect | Automatic reconnection with exponential backoff | | Anti-Call | Auto reject calls with custom message and block option | | iOS/Apple Support | Optimized sockets for iOS and macOS devices |

Message Features

| Feature | Description | |---------|-------------| | Interactive Messages | Buttons, lists, and native flows | | Media Handling | Images, videos, audio, documents, stickers | | Product Catalogs | E-commerce ready messaging | | Event Messages | Create and share calendar events | | Payment Requests | Request payments with custom amounts | | Carousel Messages | Multi-card interactive displays | | Poll Support | Create and manage polls with real-time results | | Poll Results | Display poll results with vote counts | | Album Messages | Send multiple images/videos as album | | Group Stories | Post stories to groups | | Newsletter/Channels | Manage WhatsApp channels and broadcasts | | Location Sharing | Share locations with rich metadata | | Sticker Packs | Send complete sticker collections |


Installation

# NPM
npm install xnxx-bail-pro

# Yarn
yarn add xnxx-bail-pro

# PNPM
pnpm add xnxx-bail-pro

Alternative Installation

Add to your package.json:

{
  "dependencies": {
    "@whiskeysockets/baileys": "npm:xnxx-bail-pro"
  }
}

Import

// ESM (Recommended)
import makeWASocket from 'xnxx-bail-pro'

// CommonJS
const { default: makeWASocket } = require('xnxx-bail-pro')

Quick Start

import makeWASocket, { DisconnectReason, useMultiFileAuthState } from 'xnxx-bail-pro'

async function connectToWhatsApp() {
    const { state, saveCreds } = await useMultiFileAuthState('auth_session')
    
    const sock = makeWASocket({
        auth: state,
        printQRInTerminal: true,
        browser: ['XNXX Baileys', 'Chrome', '1.0.0']
    })

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

    sock.ev.on('messages.upsert', async ({ messages }) => {
        for(const msg of messages) {
            if(!msg.key.fromMe && msg.message) {
                await sock.sendMessage(msg.key.remoteJid, { 
                    text: 'Hello from XNXX Baileys!' 
                })
            }
        }
    })

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

connectToWhatsApp()

Authentication

import makeWASocket from 'xnxx-bail-pro'

const sock = makeWASocket({
    auth: state,
    printQRInTerminal: true,
    browser: ['XNXX Bot', 'Chrome', '1.0.0']
})
const sock = makeWASocket({
    auth: state,
    printQRInTerminal: false
})

if(!sock.authState.creds.registered) {
    const phoneNumber = '1234567890' // without + or spaces
    const code = await sock.requestPairingCode(phoneNumber)
    console.log(`Pairing code: ${code}`)
}
const phoneNumber = "628XXXXX"
const code = await sock.requestPairingCode(phoneNumber.trim(), "CUSTOM01")
console.log("Your pairing code: " + code)

Socket Configuration

const NodeCache = require('node-cache')
const groupCache = new NodeCache({ stdTTL: 5 * 60, useClones: false })

const sock = makeWASocket({
    cachedGroupMetadata: async (jid) => groupCache.get(jid)
})

sock.ev.on('groups.update', async ([event]) => {
    const metadata = await sock.groupMetadata(event.id)
    groupCache.set(event.id, metadata)
})
const sock = makeWASocket({
    getMessage: async (key) => await getMessageFromStore(key)
})
const sock = makeWASocket({
    markOnlineOnConnect: false
})

Session Management

import makeWASocket, { useMultiFileAuthState } from 'xnxx-bail-pro'

const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
const sock = makeWASocket({ auth: state })

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

Note: For production, store auth in a database instead of files.


Event Handling

sock.ev.on('connection.update', (update) => {
    const { connection, lastDisconnect } = update
    if(connection === 'close') {
        const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
        console.log('Connection closed, reconnecting:', shouldReconnect)
        if(shouldReconnect) connectToWhatsApp()
    } else if(connection === 'open') {
        console.log('Connection opened')
    }
})
sock.ev.on('messages.upsert', async ({ messages }) => {
    for(const msg of messages) {
        console.log('New message:', msg)
    }
})
sock.ev.on('messages.update', async (updates) => {
    for(const update of updates) {
        console.log('Message updated:', update)
    }
})
sock.ev.on('messages.update', async (event) => {
    for(const { key, update } of event) {
        if(update.pollUpdates) {
            const pollCreation = await getMessage(key)
            if(pollCreation) {
                console.log('Poll update:', getAggregateVotesInPollMessage({
                    message: pollCreation,
                    pollUpdates: update.pollUpdates,
                }))
            }
        }
    }
})

Data Store

import makeWASocket, { makeInMemoryStore } from 'xnxx-bail-pro'

const store = makeInMemoryStore({})
store.readFromFile('./baileys_store.json')

setInterval(() => {
    store.writeToFile('./baileys_store.json')
}, 10_000)

const sock = makeWASocket({})
store.bind(sock.ev)

sock.ev.on('chats.upsert', () => {
    console.log('Got chats:', store.chats.all())
})

sock.ev.on('contacts.upsert', () => {
    console.log('Got contacts:', Object.values(store.contacts))
})

Important: Build your own data store for production. In-memory storage wastes RAM.


WhatsApp IDs

| Type | Format | Example | |------|--------|---------| | Personal Chat | [country code][phone number]@s.whatsapp.net | [email protected] | | Group | [group id]@g.us | [email protected] | | Broadcast List | [timestamp]@broadcast | 1234567890@broadcast | | Status | status@broadcast | status@broadcast | | Newsletter | [newsletter id]@newsletter | 1234567890@newsletter |


Sending Messages

Non-Media Messages

await sock.sendMessage(jid, { text: 'Hello World!' })
await sock.sendMessage(jid, { text: 'This is a reply' }, { quoted: message })
await sock.sendMessage(jid, {
    text: '@12345678901',
    mentions: ['[email protected]']
})
await sock.sendAlbumMessage(
    jid,
    [
        {
            image: { url: "https://example.jpg" },
            caption: "Hello World",
        },
        {
            video: { url: "https://example.mp4" },
            caption: "Hello World",
        },
    ],
    { 
        quoted: message, 
        delay: 2000
    }
)
await sock.sendMessage(jid, {
    requestPayment: {      
        currency: "USD",
        amount: "10000000",
        from: "[email protected]",
        note: "Payment Request",
        background: { }
    }
}, { quoted: message })
await sock.sendMessage(jid, { 
    event: {
        isCanceled: false,
        name: "Event Name", 
        description: "Event Description",
        location: { 
            degreesLatitude: -0, 
            degreesLongitude: -0 
        },
        startTime: m.messageTimestamp.low,
        endTime: m.messageTimestamp.low + 86400,
    }
}, { quoted: message })
await sock.sendMessage(jid, {
    productMessage: {
        title: "Product Title",
        description: "Product Description",
        thumbnail: "https://example.png",
        productId: "123456789",
        retailerId: "STORE",
        url: "https://example.png",
    }
}, { quoted: message })
await sock.sendMessage(jid, {
    carouselMessage: {
        caption: "Click URL",
        footer: "Powered By XNXX Baileys",
        cards: [
            {
                headerTitle: "Card 1",
                imageUrl: "https://example.com/image.jpg",
                productTitle: "Premium Product",
                productDescription: "Get premium access",
                bodyText: "Description here",
                buttons: [
                    {
                        name: "cta_call",
                        params: { 
                            display_text: "Contact", 
                            phone_number: "+1234567890" 
                        }
                    }
                ]
            }
        ]
    }
}, { quoted: message })
await sock.sendMessage(jid, {
    text: "Description of Message",
    title: "Title of Message",
    footer: "Footer Message",
    interactiveButtons: [
        {
            name: "quick_reply",
            buttonParamsJson: JSON.stringify({
                display_text: "Quick Reply",
                id: "button_1"
            })
        },
        {
            name: "cta_url",
            buttonParamsJson: JSON.stringify({
                display_text: "Visit Website",
                url: "https://example.com"
            })
        }
    ]
}, { quoted: message })
await sock.sendMessage(jid, {
    location: {
        degreesLatitude: 24.121231,
        degreesLongitude: 55.1121221,
        name: "Location Name",
        address: "Location Address"
    }
})
const vcard = 'BEGIN:VCARD\n'
    + 'VERSION:3.0\n'
    + 'FN:John Doe\n'
    + 'ORG:Company;\n'
    + 'TEL;type=CELL;type=VOICE;waid=1234567890:+1 234 567 890\n'
    + 'END:VCARD'

await sock.sendMessage(jid, {
    contacts: {
        displayName: 'John Doe',
        contacts: [{ vcard }]
    }
})
await sock.sendMessage(jid, {
    react: {
        text: '❤️',
        key: message.key
    }
})
await sock.sendMessage(jid, {
    poll: {
        name: 'Favorite Color?',
        values: ['Red', 'Blue', 'Green', 'Yellow'],
        selectableCount: 1
    }
})

Media Messages

// From URL
await sock.sendMessage(jid, {
    image: { url: 'https://example.com/image.jpg' },
    caption: 'Beautiful image!'
})

// From Buffer
await sock.sendMessage(jid, {
    image: buffer,
    caption: 'Image from buffer'
})
await sock.sendMessage(jid, {
    video: { url: './video.mp4' },
    caption: 'Check this out!',
    gifPlayback: false,
    ptv: false
})
await sock.sendMessage(jid, {
    audio: { url: './audio.mp3' },
    mimetype: 'audio/mp4',
    ptt: true
})
await sock.sendMessage(jid, {
    document: { url: './document.pdf' },
    fileName: 'document.pdf',
    mimetype: 'application/pdf'
})
await sock.sendMessage(jid, {
    sticker: { url: './sticker.webp' }
})
await sock.stickerPackMessage(jid, {
    name: 'My Stickers',
    publisher: 'Your Bot',
    description: 'Collection of stickers',
    stickers: [
        { data: buffer, emojis: ['😊'] },
        { data: './sticker.png', emojis: ['😂'] },
        { data: 'https://example.com/sticker.jpg', emojis: ['❤️'] }
    ],
    cover: buffer
}, { quoted: message });

Message Modifications

const msg = await sock.sendMessage(jid, { text: 'hello' })
await sock.sendMessage(jid, { delete: msg.key })
await sock.sendMessage(jid, {
    text: 'Updated message text',
    edit: originalMessage.key
})

Media Operations

import { downloadMediaMessage, getContentType } from 'xnxx-bail-pro'

sock.ev.on('messages.upsert', async ({ messages }) => {
    const msg = messages[0]
    if(!msg.message) return
    
    const messageType = getContentType(msg.message)
    
    if(messageType === 'imageMessage') {
        const buffer = await downloadMediaMessage(
            msg,
            'buffer',
            {},
            {
                logger: console,
                reuploadRequest: sock.updateMediaMessage
            }
        )
        fs.writeFileSync('./download.jpeg', buffer)
    }
})

Group Management

const group = await sock.groupCreate('Group Name', [
    '[email protected]',
    '[email protected]'
])
console.log('Group created:', group.id)
// Add
await sock.groupParticipantsUpdate(groupJid, ['[email protected]'], 'add')

// Remove
await sock.groupParticipantsUpdate(groupJid, ['[email protected]'], 'remove')

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

// Demote from admin
await sock.groupParticipantsUpdate(groupJid, ['[email protected]'], 'demote')
// Only admins can send messages
await sock.groupSettingUpdate(groupJid, 'announcement')

// Everyone can send messages
await sock.groupSettingUpdate(groupJid, 'not_announcement')

// Only admins can edit group info
await sock.groupSettingUpdate(groupJid, 'locked')

// Everyone can edit group info
await sock.groupSettingUpdate(groupJid, 'unlocked')

User Operations

const [result] = await sock.onWhatsApp('1234567890')
if(result?.exists) {
    console.log('Number exists:', result.jid)
}
const ppUrl = await sock.profilePictureUrl(jid)
const ppUrlHD = await sock.profilePictureUrl(jid, 'image')
await sock.updateProfilePicture(jid, {
    url: './profile.jpg'
})
const status = await sock.fetchStatus(jid)
console.log('Status:', status)
await sock.presenceSubscribe(jid)
await sock.sendPresenceUpdate('available', jid)
// Options: available, unavailable, composing, recording, paused

Privacy Controls

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

// Unblock
await sock.updateBlockStatus(jid, 'unblock')
// Last seen: 'all', 'contacts', 'contact_blacklist', 'none'
await sock.updateLastSeenPrivacy('contacts')

// Online: 'all', 'match_last_seen'
await sock.updateOnlinePrivacy('all')

// Profile picture: 'all', 'contacts', 'contact_blacklist', 'none'
await sock.updateProfilePicturePrivacy('contacts')

// Groups add: 'all', 'contacts', 'contact_blacklist'
await sock.updateGroupsAddPrivacy('contacts')

Chat Operations

const lastMsg = await getLastMessageInChat(jid)
await sock.chatModify({
    archive: true,
    lastMessages: [lastMsg]
}, jid)
// Mute for 8 hours
await sock.chatModify({
    mute: 8 * 60 * 60 * 1000
}, jid)

// Unmute
await sock.chatModify({
    mute: null
}, jid)
// Pin
await sock.chatModify({ pin: true }, jid)

// Unpin
await sock.chatModify({ pin: false }, jid)

Broadcast & Stories

await sock.sendMessage(jid, {
    text: 'Broadcast message',
    statusJidList: [
        '[email protected]',
        '[email protected]'
    ],
    broadcast: true
})
await sock.sendMessage('status@broadcast', {
    image: { url: './story.jpg' },
    caption: 'My story update!'
})
// Create newsletter
await sock.newsletterCreate('Newsletter Name', {
    description: 'Newsletter description',
    picture: buffer
})

// Update newsletter
await sock.newsletterUpdateMetadata(newsletterJid, {
    name: 'New Name',
    description: 'New description'
})

// Follow/Unfollow
await sock.newsletterFollow(newsletterJid)
await sock.newsletterUnfollow(newsletterJid)

Advanced Features

// Enable (86400 = 24h, 604800 = 7d, 7776000 = 90d)
await sock.sendMessage(jid, {
    disappearingMessagesInChat: 86400
})

// Disable
await sock.sendMessage(jid, {
    disappearingMessagesInChat: false
})
const msg = await sock.loadMessage(jid, messageId)
console.log('Message:', msg)
const info = await sock.messageInfo(jid, messageId)
console.log('Read by:', info.readBy.length)
console.log('Played by:', info.playedBy.length)

GitHub Statistics


Best Practices

import { useMultiFileAuthState } from 'xnxx-bail-pro'

const { state, saveCreds } = await useMultiFileAuthState('auth_folder')
const sock = makeWASocket({ auth: state })

sock.ev.on('creds.update', saveCreds)
import { makeInMemoryStore } from 'xnxx-bail-pro'

const store = makeInMemoryStore({})
store.readFromFile('./store.json')

setInterval(() => {
    store.writeToFile('./store.json')
}, 10_000)

store.bind(sock.ev)
try {
    await sock.sendMessage(jid, { text: 'Hello' })
} catch(error) {
    if(error.output?.statusCode === 401) {
        console.log('Not authorized')
    } else {
        console.error('Send failed:', error)
    }
}
sock.ev.on('connection.update', async (update) => {
    const { connection, lastDisconnect } = update
    
    if(connection === 'close') {
        const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
        
        if(shouldReconnect) {
            console.log('Reconnecting...')
            await connectToWhatsApp()
        }
    }
})

Important Notes

WhatsApp ID Formats

  • Personal: [country_code][phone_number]@s.whatsapp.net
  • Group: [group_id]@g.us
  • Broadcast: [timestamp]@broadcast
  • Status: status@broadcast
  • Newsletter: [newsletter_id]@newsletter

Message Types

All supported message types:

  • conversation - Text
  • imageMessage - Image
  • videoMessage - Video
  • audioMessage - Audio
  • documentMessage - Document
  • stickerMessage - Sticker
  • locationMessage - Location
  • contactMessage - Contact
  • pollCreationMessage - Poll
  • reactionMessage - Reaction
  • editedMessage - Edited message
  • viewOnceMessage - View once media
  • extendedTextMessage - Text with link preview

Events Reference

// Connection events
'connection.update', 'creds.update'

// Message events
'messages.upsert', 'messages.update', 'messages.delete', 'message-receipt.update'

// Chat events
'chats.set', 'chats.upsert', 'chats.update', 'chats.delete'

// Contact events
'contacts.set', 'contacts.upsert', 'contacts.update'

// Group events
'groups.upsert', 'groups.update', 'group-participants.update'

// Presence events
'presence.update'

// Call events
'call'

// Blocklist events
'blocklist.set', 'blocklist.update'

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.


Disclaimer

This project is NOT officially affiliated with WhatsApp or Meta. This is an independent project and should be used responsibly.

Important:

  • Follow WhatsApp's Terms of Service
  • Don't spam or send unsolicited messages
  • Respect user privacy
  • Use for legitimate purposes only
  • Be aware of WhatsApp's rate limits

Acknowledgments

Special thanks to:

  • WhiskeySockets - For the original Baileys library
  • All contributors - For helping improve this project
  • The community - For continuous support and feedback

Support & Contact

Made with passion

Forged by xnx6x

Based on WhiskeySockets/Baileys

Star this repository if you find it useful!

Built with ❤️ and ☕ by developers, for developers