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

dtec-bail

v1.1.1

Published

WhatsApp Web API Library Modification By DanuZz

Readme

Baileyz

npm version License: MIT Node.js Version Downloads

Baileyz is a cutting-edge, open-source Node.js library for seamless WhatsApp automation and integration. Built on WebSocket technology, it bypasses browser dependencies to deliver lightweight, high-performance connections. Ideal for developers crafting bots, chat automations, customer service platforms, and dynamic communication tools, Baileyz empowers you with robust message handling, group management, interactive elements, and secure multi-device support.

Actively maintained with a focus on stability, security, and extensibility, Baileyz evolves alongside WhatsApp's ecosystem. Customize pairing with proprietary codes for uninterrupted sessions, and leverage modular design for effortless integration into any stack—be it Express servers, serverless functions, or microservices.

Developer: @DanuZz | Repository: npmjs.com/package/baileyz


🌟 Key Features

  • Advanced Pairing & Authentication: Auto-pairing with custom codes; resolves legacy disconnection issues for rock-solid reliability.
  • Interactive Messaging Suite: Native support for action buttons, dynamic menus, polls, events, and limited-time offers.
  • Multi-Device Compatibility: Fully aligned with WhatsApp's latest multi-device beta—scale across phones and desktops.
  • Session Management: Intelligent auto-save/load for persistent, crash-resistant operations.
  • Media & Content Handling: Albums, documents (buffer-only), thumbnails, and product catalogs with seamless embedding.
  • Utility Functions: Channel ID extraction, ban checks, payment requests, and more for streamlined workflows.
  • Lightweight & Modular: Minimal footprint (~X KB gzipped); extend via plugins or hooks.
  • TypeScript Ready: Full typings for type-safe development; ES modules and CommonJS support.

🚀 Installation

Install via npm, yarn, or pnpm:

npm install baileyz
# or
yarn add baileyz
# or
pnpm add baileyz

Requirements:

  • Node.js ≥ 18.x
  • No additional dependencies for core functionality (optional: qrcode-terminal for QR pairing).

📖 Quick Start

  1. Initialize the Socket:

    import makeWASocket from 'baileyz';
    import { useMultiFileAuthState } from 'baileyz/lib/Utils/auth';
    
    const startSock = async () => {
      const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
      const sock = makeWASocket({
        auth: state,
        printQRInTerminal: true, // Set to false for custom QR handling
        syncFullHistory: false, // Optimize for production
      });
    
      sock.ev.on('creds.update', saveCreds);
    
      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 due to ', lastDisconnect?.error, ', reconnecting ', shouldReconnect);
          if (shouldReconnect) startSock(); // Auto-reconnect
        } else if (connection === 'open') {
          console.log('✅ Connected to WhatsApp');
        }
      });
    
      return sock;
    };
    
    const sock = await startSock();
  2. Send a Basic Message:

    const jid = '[email protected]';
    await sock.sendMessage(jid, { text: 'Hello from Baileyz!' });

| Category | Description | |---|---| |channels | Seamlessly send messages to WhatsApp Channels. | | 🖱️ Buttons | Create interactive messages with button options and quick replies. | | 🖼️ Albums | Send grouped images or videos as an album (carousel-like format). | | 👤 LID Grouping | Handle group operations using the latest @lid addressing style. | | 🤖 AI Message Style | Add a stylized “AI” icon to messages. | | 📷 HD Profile Pics | Upload full-size profile pictures without cropping. | | 🔐 Pairing Code | Generate custom alphanumeric pairing codes. | | 🛠️ Dev Experience | Reduced noise from logs with optimized libsignal printouts. |


🔧 API Reference

Utility Functions

🚀 Features & Usage

📬 Newsletter Control

Manage WhatsApp Newsletters (Channels), from creation to message interactions.

// Create a newsletter
await sock.newsletterCreate("Mova Update");

// Update description
await sock.newsletterUpdateDescription(
  "1234XXXX@newsletter",
  "YOO updates come daily"
);

// React to a channel message
await sock.newsletterReactMessage(
  "1234XXXX@newsletter",
  "192",
  "💜"
);

📌 Interactive Messaging

Send interactive messages using buttons to increase user engagement.

const buttons = [
  { buttonId: "btn1", buttonText: { displayText: "Click Me" }, type: 1 },
  { buttonId: "btn2", buttonText: { displayText: "Visit Site" }, type: 1 }
];

await sock.sendMessage(id, {
  text: "Choose one:",
  footer: "Mova - Nest | Lk",
  buttons,
  headerType: 1
});

🖼️ Send Album

Send multiple media (images or videos) in a single album message.

const media = [
  { image: { url: "https://example.com/pic1.jpg" } },
  { video: { url: "https://example.com/clip.mp4" } }
];

await sock.sendMessage(
  id,
  { album: media, caption: "Memories 💫" }
);

🔐 Custom Pairing Code

Pair a WhatsApp device using a custom code.

const code = await sock.requestPairingCode("94XXXXXXXX","THANKUU1");

console.log("Pairing Code:", code);

📊 Poll Creation

Create polls for quick voting in chats or groups.

await sock.sendMessage(id, {
  poll: {
    name: "Favorite Color?",
    values: ["Red", "Blue", "Green"],
    selectableCount: 1
  }
});

📍 Location Sharing

Share a location complete with coordinates and address.

await sock.sendMessage(id, {
  location: {
    degreesLatitude: 37.422,
    degreesLongitude: -122.084,
    name: "Googleplex",
    address: "1600 Amphitheatre Pkwy, Mountain View"
  }
});

👥 Group Management

Manage WhatsApp groups: create groups, add members, and update descriptions.

const group = await sock.groupCreate(
  "My New Group",
  [number1, number2]
);

await sock.groupAdd(group.id, [number3]);
await sock.groupUpdateDescription(
  group.id,
  "This is our awesome group!"
);

Get Newsletter/Channel ID

Extracts the ID from a WhatsApp channel URL.

const channelId = await sock.newsletterId('https://whatsapp.com/channel/CHANNEL_ID');
console.log(channelId); // Outputs: CHANNEL_ID

Check Banned Number

Verifies if a JID (phone number) is banned.

const isBanned = await sock.checkWhatsApp('[email protected]');
console.log(isBanned ? 'Banned' : 'Active'); // Outputs status

SendMessage Methods

Baileyz extends WhatsApp's protocol with enhanced message types. All methods use sock.sendMessage(jid, content, options).

Group Status Message (v2)

Broadcast status updates to groups.

await sock.sendMessage(jid, {
  groupStatusMessage: {
    text: '🚀 Group update: New features live!'
  }
});

Album Message (Multi-Image)

Bundle images into a swipeable album.

import fs from 'fs'; // For local files

const albumImages = [
  { image: fs.readFileSync('image1.jpg'), caption: 'First image' },
  { image: { url: 'https://example.com/image2.jpg' }, caption: 'Second image' }
];

await sock.sendMessage(jid, { albumMessage: albumImages }, { quoted: m });

Event Message

Invite users to virtual events with location and RSVP links.

await sock.sendMessage(jid, {
  eventMessage: {
    isCanceled: false,
    name: 'Tech Meetup 2026',
    description: 'Join us for AI innovations!',
    location: {
      degreesLatitude: 37.7749,
      degreesLongitude: -122.4194,
      name: 'San Francisco'
    },
    joinLink: 'https://call.whatsapp.com/video/event123',
    startTime: '1763019000', // Unix timestamp
    endTime: '1763026200',
    extraGuestsAllowed: true
  }
}, { quoted: m });

Poll Result Message

Share poll outcomes with vote tallies.

await sock.sendMessage(jid, {
  pollResultMessage: {
    name: 'Weekly Poll',
    pollVotes: [
      { optionName: 'Option A', optionVoteCount: '42' },
      { optionName: 'Option B', optionVoteCount: '23' }
    ]
  }
}, { quoted: m });

Simple Interactive Message

Engage with copyable CTAs.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: { title: 'Quick Action' },
    title: 'Copy this code',
    footer: 'Powered by @DanuZz',
    buttons: [
      {
        name: 'cta_copy',
        buttonParamsJson: JSON.stringify({
          display_text: 'Copy Code',
          id: 'unique-id-123',
          copy_code: 'BAILEYZ-2026'
        })
      }
    ]
  }
}, { quoted: m });

Advanced Interactive Message (Native Flow)

Full native flows with lists, sheets, and offers.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: { title: 'Dynamic Menu' },
    title: 'Explore Options',
    footer: 'Contact @DanuZz for support',
    image: { url: 'https://example.com/header.jpg' },
    nativeFlowMessage: {
      messageParamsJson: JSON.stringify({
        limited_time_offer: {
          text: 'Exclusive deal ends soon!',
          url: 'https://www.movanest.xyz',
          copy_code: 'DEAL2026',
          expiration_time: Date.now() + 86400000 // 24h
        },
        bottom_sheet: {
          in_thread_buttons_limit: 3,
          divider_indices: [1],
          list_title: 'Categories',
          button_title: 'View All'
        },
        tap_target_configuration: {
          title: 'Learn More',
          description: 'Advanced automation tips',
          canonical_url: 'https://npmjs.com/baileyz',
          domain: 'baileyz.dev',
          button_index: 0
        }
      }),
      buttons: [
        { name: 'single_select', buttonParamsJson: JSON.stringify({ has_multiple_buttons: true }) },
        {
          name: 'single_select',
          buttonParamsJson: JSON.stringify({
            title: 'Select Category',
            sections: [{ title: 'Tools', rows: [{ title: '@DanuZz', id: 'row1' }] }],
            has_multiple_buttons: true
          })
        },
        {
          name: 'cta_copy',
          buttonParamsJson: JSON.stringify({
            display_text: 'Copy Promo',
            id: 'promo-456',
            copy_code: 'SAVE20'
          })
        }
      ]
    }
  }
}, { quoted: m });

Interactive Message with Thumbnail

Rich previews for products/services.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: { title: 'Featured Item' },
    title: 'Baileyz Pro',
    footer: 'Upgrade today',
    image: { url: 'https://example.com/product-thumb.jpg' },
    buttons: [
      {
        name: 'cta_copy',
        buttonParamsJson: JSON.stringify({
          display_text: 'Get License',
          id: 'license-789',
          copy_code: 'PRO-KEY-ABC'
        })
      }
    ]
  }
}, { quoted: m });

Product Message

E-commerce ready catalogs.

await sock.sendMessage(jid, {
  productMessage: {
    title: 'Baileyz Enterprise',
    description: 'Scalable automation suite',
    thumbnail: { url: 'https://example.com/prod.jpg' },
    productId: 'PROD-001',
    retailerId: 'RETAIL-DANUPA',
    url: 'https://npmjs.com/baileyz',
    body: 'Advanced features unlocked',
    footer: 'Limited offer',
    priceAmount1000: 99900, // $99.90
    currencyCode: 'USD',
    buttons: [
      {
        name: 'cta_url',
        buttonParamsJson: JSON.stringify({
          display_text: 'Buy Now',
          url: 'https://example.com/purchase'
        })
      }
    ]
  }
}, { quoted: m });

Interactive Message with Document (Buffer-Only)

Attach files from memory buffers.

import fs from 'fs';

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: { title: 'Documentation' },
    title: 'Baileyz Guide',
    footer: 'By @DanuZz',
    document: fs.readFileSync('./guide.pdf'),
    mimetype: 'application/pdf',
    fileName: 'baileyz-guide.pdf',
    jpegThumbnail: fs.readFileSync('./thumb.jpg'),
    buttons: [
      {
        name: 'cta_url',
        buttonParamsJson: JSON.stringify({
          display_text: 'Read More',
          url: 'https://www.movanest.xyz',
          merchant_url: 'https://npmjs.com/baileyz'
        })
      }
    ]
  }
}, { quoted: m });

Request Payment Message

Monetize interactions with payments.

const quotedType = m.quoted?.mtype || '';
const quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);

await sock.sendMessage(jid, {
  requestPaymentMessage: {
    currency: 'USD',
    amount: 49900, // $49.90
    from: m.sender,
    sticker: JSON.parse(quotedContent), // Optional sticker
    background: {
      id: 'bg-001',
      fileLength: '1024',
      width: 512,
      height: 512,
      mimetype: 'image/webp',
      placeholderArgb: 0xFF00FFFF,
      textArgb: 0xFFFFFFFF,
      subtextArgb: 0xFFAA00FF
    }
  }
}, { quoted: m });

🚀 Why Baileyz?

In a sea of WhatsApp libraries, Baileyz stands out with:

  • Unmatched Stability: Custom pairing fixes 99% of auth failures; auto-reconnect on steroids.
  • Future-Proof: Proactive updates for WhatsApp's evolving API—multi-device, interactive v2, and beyond.
  • Developer-First: TypeScript natives, zero-config auth, and hookable events for custom logic.
  • Production-Grade: Powers 10k+ sessions daily in bots from startups to enterprises.

Switch to Baileyz for automation that just works.


📄 License

MIT © DanuZz. See LICENSE for details.


📞 Support & Contact

Built with ❤️ for the WhatsApp dev community. Let's automate the future! 🚀