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

@mihiranga_mihiranga/mezuka-baileys

v1.0.2

Published

Baileys Mod By blackcat ofc

Readme

🚀 @mezuka/baileys

Advanced WhatsApp Web API - Modified by Black Cat OFC

npm version License: MIT Downloads Node.js WhatsApp


👨‍💻 Owner: Nimeshka Mihiran | Team: Black Cat OFC


📑 Table of Contents


✨ Features

| Feature | Status | Feature | Status | |---------|--------|---------|--------| | 🔐 QR Code Auth | ✅ | 📱 Pairing Code | ✅ | | 💬 All Message Types | ✅ | 🖼️ Media Support | ✅ | | 👥 Group Management | ✅ | 📊 Polls & Events | ✅ | | 🔒 Privacy Controls | ✅ | 🎨 Interactive Buttons | ✅ | | 📦 Product Messages | ✅ | 💳 Payment Messages | ✅ | | 🤖 AI Integration | ✅ | 🌐 Multi-Device | ✅ |


📦 Installation

NPM Installation

npm install @mezuka/baileys

Yarn Installation

yarn add @mezuka/baileys

Using as Baileys Fork

Add to your package.json:

{
  "dependencies": {
    "baileys": "npm:@mezuka/baileys"
  }
}

🚀 Quick Start

Basic Setup with QR Code

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

async function connectToWhatsApp() {
    const { state, saveCreds } = await useMultiFileAuthState('./auth_info_baileys')
    
    const sock = makeWASocket({
        auth: state,
        printQRInTerminal: true,
        browser: ['Black Cat Bot', 'Chrome', '1.0.0']
    })
    
    sock.ev.on('connection.update', (update) => {
        const { connection, lastDisconnect } = update
        
        if(connection === 'close') {
            const shouldReconnect = (lastDisconnect?.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
            console.log('Connection closed, reconnecting:', shouldReconnect)
            
            if(shouldReconnect) {
                connectToWhatsApp()
            }
        } else if(connection === 'open') {
            console.log('✅ Connected successfully!')
        }
    })
    
    sock.ev.on('messages.upsert', async ({ messages }) => {
        for (const m of messages) {
            console.log('📨 New message:', m)
            
            if(m.message) {
                await sock.sendMessage(m.key.remoteJid!, { 
                    text: '👋 Hello from @mezuka/baileys!' 
                })
            }
        }
    })
    
    sock.ev.on('creds.update', saveCreds)
}

connectToWhatsApp()

🔐 Authentication Methods

Method 1: Pairing Code (Recommended)

import makeWASocket from '@mezuka/baileys'

const sock = makeWASocket({
    printQRInTerminal: false
})

if (!sock.authState.creds.registered) {
    const phoneNumber = '94712345678' // Without + or special characters
    const code = await sock.requestPairingCode(phoneNumber)
    console.log(`🔑 Pairing Code: ${code}`)
}

Method 2: Single File Auth

import { useSingleFileAuthState } from '@mezuka/baileys'

const { state, saveState } = await useSingleFileAuthState('./auth.json')

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

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

Method 3: MongoDB Auth

import { useMongoFileAuthState } from '@mezuka/baileys'
import { MongoClient } from 'mongodb'

const client = new MongoClient('mongodb://localhost:27017')
await client.connect()

const collection = client.db('whatsapp').collection('sessions')
const { state, saveCreds } = await useMongoFileAuthState(collection)

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

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

📨 Sending Messages

Text Messages

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

// With mentions
await sock.sendMessage(jid, {
    text: '@94712345678 Check this out!',
    mentions: ['[email protected]']
})

// Quote/Reply
await sock.sendMessage(jid, {
    text: 'This is a reply'
}, {
    quoted: message
})

Media Messages

// Image
await sock.sendMessage(jid, {
    image: { url: './image.jpg' },
    caption: 'Beautiful image! 📸'
})

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

// Audio
await sock.sendMessage(jid, {
    audio: { url: './audio.mp3' },
    mimetype: 'audio/mp4',
    ptt: true // Voice message
})

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

// Sticker
await sock.sendMessage(jid, {
    sticker: { url: './sticker.webp' }
})

Interactive Messages

// Buttons
await sock.sendMessage(jid, {
    text: 'Choose an option:',
    footer: 'Powered by @mezuka/baileys',
    buttons: [
        { buttonId: 'id1', buttonText: { displayText: 'Option 1' } },
        { buttonId: 'id2', buttonText: { displayText: 'Option 2' } },
        { buttonId: 'id3', buttonText: { displayText: 'Option 3' } }
    ]
})

// List Message
await sock.sendMessage(jid, {
    text: 'Select from menu:',
    footer: 'Black Cat OFC',
    title: 'Main Menu',
    buttonText: 'View Options',
    sections: [{
        title: 'Section 1',
        rows: [
            { title: 'Option 1', rowId: 'opt1', description: 'First option' },
            { title: 'Option 2', rowId: 'opt2', description: 'Second option' }
        ]
    }]
})

// Advanced Interactive Buttons
await sock.sendMessage(jid, {
    text: 'Interactive Menu',
    title: 'Welcome!',
    footer: 'Choose wisely',
    interactiveButtons: [
        {
            name: 'quick_reply',
            buttonParamsJson: JSON.stringify({
                display_text: 'Quick Reply',
                id: 'quick_1'
            })
        },
        {
            name: 'cta_url',
            buttonParamsJson: JSON.stringify({
                display_text: 'Visit Website',
                url: 'https://github.com/mezuka'
            })
        },
        {
            name: 'cta_call',
            buttonParamsJson: JSON.stringify({
                display_text: 'Call Us',
                phone_number: '+94712345678'
            })
        }
    ]
})

Special Messages

// Poll
await sock.sendMessage(jid, {
    poll: {
        name: 'Favorite Programming Language?',
        values: ['JavaScript', 'Python', 'Java', 'C++'],
        selectableCount: 1
    }
})

// Location
await sock.sendMessage(jid, {
    location: {
        degreesLatitude: 6.9271,
        degreesLongitude: 79.8612,
        name: 'Colombo, Sri Lanka'
    }
})

// Contact Card
const vcard = 'BEGIN:VCARD\n'
    + 'VERSION:3.0\n'
    + 'FN:Nimeshka Mihiran\n'
    + 'ORG:Black Cat OFC\n'
    + 'TEL;type=CELL;type=VOICE;waid=94712345678:+94 71 234 5678\n'
    + 'END:VCARD'

await sock.sendMessage(jid, {
    contacts: {
        displayName: 'Nimeshka',
        contacts: [{ vcard }]
    }
})

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

🎨 Advanced Features

Album/Carousel Messages

await sock.sendMessage(jid, {
    album: [
        {
            image: { url: './image1.jpg' },
            caption: 'Photo 1'
        },
        {
            image: { url: './image2.jpg' },
            caption: 'Photo 2'
        },
        {
            video: { url: './video.mp4' },
            caption: 'Video 1'
        }
    ]
})

AI-Powered Messages

await sock.sendMessage(jid, {
    text: 'This message has AI processing enabled! 🤖'
}, {
    ai: true
})

View Once Messages

await sock.sendMessage(jid, {
    image: { url: './private.jpg' },
    caption: 'This disappears after viewing',
    viewOnce: true
})

Status/Story Messages

await sock.sendStatusMentions(
    {
        text: 'Hello everyone! 👋',
        font: 2,
        textColor: 'FF0000',
        backgroundColor: '#000000'
    },
    ['[email protected]', '[email protected]']
)

👥 Group Management

Create Group

const group = await sock.groupCreate(
    'Black Cat Developers',
    ['[email protected]', '[email protected]']
)
console.log('Group created:', group.id)

Manage Participants

// Add members
await sock.groupParticipantsUpdate(
    groupJid,
    ['[email protected]'],
    'add'
)

// Remove members
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'
)

Group Settings

// Change name
await sock.groupUpdateSubject(groupJid, 'New Group Name')

// Change description
await sock.groupUpdateDescription(groupJid, 'New amazing description')

// Update settings
await sock.groupSettingUpdate(groupJid, 'announcement') // Only admins can send
await sock.groupSettingUpdate(groupJid, 'not_announcement') // Everyone can send
await sock.groupSettingUpdate(groupJid, 'locked') // Only admins edit info
await sock.groupSettingUpdate(groupJid, 'unlocked') // Everyone can edit info

// Get invite code
const code = await sock.groupInviteCode(groupJid)
console.log('Invite link:', `https://chat.whatsapp.com/${code}`)

// Revoke invite code
await sock.groupRevokeInvite(groupJid)

🔒 Privacy & Security

Block/Unblock Users

await sock.updateBlockStatus(jid, 'block')
await sock.updateBlockStatus(jid, 'unblock')

Privacy Settings

// Last seen
await sock.updateLastSeenPrivacy('all') // 'contacts' | 'contact_blacklist' | 'none'

// Profile picture
await sock.updateProfilePicturePrivacy('contacts')

// Status
await sock.updateStatusPrivacy('contacts')

// Read receipts
await sock.updateReadReceiptsPrivacy('all')

// Groups
await sock.updateGroupsAddPrivacy('contacts')

Disappearing Messages

// Enable (7 days)
await sock.sendMessage(jid, {
    disappearingMessagesInChat: 604800
})

// Disable
await sock.sendMessage(jid, {
    disappearingMessagesInChat: false
})

📞 Contact & Support

🌟 Owner: Nimeshka Mihiran

👥 Team: Black Cat OFC

Instagram GitHub WhatsApp Email

📢 Join Our Community

WhatsApp Channel Telegram Discord


📚 Additional Resources

Utility Functions

import { 
    getContentType,
    getDevice,
    downloadContentFromMessage,
    makeCacheableSignalKeyStore
} from '@mezuka/baileys'

// Get message type
const type = getContentType(message)

// Download media
const buffer = await downloadContentFromMessage(message, 'image')

// Check if number exists
const [result] = await sock.onWhatsApp('94712345678')
if (result.exists) console.log('Number exists!')

Data Store Implementation

import { makeInMemoryStore } from '@mezuka/baileys'

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

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

store.bind(sock.ev)

// Access chats
console.log('All chats:', store.chats.all())
console.log('All contacts:', Object.values(store.contacts))

🎯 Best Practices

Performance Optimization

import { makeCacheableSignalKeyStore } from '@mezuka/baileys'
import NodeCache from 'node-cache'

// Cache group metadata
const groupCache = new NodeCache({ stdTTL: 300, useClones: false })

const sock = makeWASocket({
    cachedGroupMetadata: async (jid) => groupCache.get(jid),
    getMessage: async (key) => await getMessageFromStore(key)
})

sock.ev.on('groups.update', async ([event]) => {
    const metadata = await sock.groupMetadata(event.id)
    groupCache.set(event.id, metadata)
})

Error Handling

sock.ev.on('connection.update', (update) => {
    const { connection, lastDisconnect, qr } = update
    
    if(qr) {
        console.log('QR Code:', qr)
    }
    
    if(connection === 'close') {
        const statusCode = (lastDisconnect?.error as Boom)?.output?.statusCode
        const shouldReconnect = statusCode !== DisconnectReason.loggedOut
        
        console.log('Connection closed. Status:', statusCode)
        
        if(shouldReconnect) {
            setTimeout(() => connectToWhatsApp(), 3000)
        }
    }
})

📄 License

This project is licensed under the MIT License.


⭐ Star us on GitHub!

Made with ❤️ by Black Cat OFC

Special thanks to the original Baileys developers

Visitor Count