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

@fanzxnothuman/baileys

v2.0.17

Published

WhatsApp API Modification By Fanzx & KyuuRzy

Downloads

268

Readme

WhatsApp Baileys

WhatsApp Baileys is a robust open-source library engineered to empower developers in building sophisticated automation solutions and seamless WhatsApp integrations. Leveraging WebSocket technology — entirely browser-free — it delivers a comprehensive suite of capabilities including message management, chat handling, group administration, interactive messages, and dynamic action buttons for an elevated user experience.

Continuously developed and actively maintained, Baileys receives consistent updates to strengthen stability and overall performance. A primary area of focus is the refinement of pairing and authentication workflows, ensuring a more resilient and secure connection. Pairing procedures are fully customizable with user-defined codes, significantly reducing the likelihood of failures or unexpected disconnections.

This library is purpose-built for constructing enterprise-grade bots, chat automation pipelines, customer service platforms, and a wide spectrum of communication automation applications demanding both high reliability and feature completeness. Its lightweight, modular architecture ensures effortless integration across diverse systems and deployment environments.


Key Features & Advantages

  • Fully supports both automatic and custom pairing workflows
  • Resolves longstanding pairing instability and disconnection issues
  • Delivers interactive messages, action buttons, and dynamic menu rendering
  • Intelligent session management with minimal overhead for sustained reliability
  • Full compatibility with WhatsApp's latest multi-device architecture
  • Lightweight, stable, and designed for seamless third-party integration
  • Ideal for building bots, automation pipelines, and end-to-end communication solutions
  • Thorough documentation and practical code examples to accelerate development

Getting Started

Install the library through your preferred package manager and follow the configuration guide provided. The included example code offers a clear foundation for understanding each feature. Leverage session storage and interactive messaging capabilities to craft stable, production-ready solutions tailored to your specific requirements.


Additional Functions

Label Group

Assign a tag or label to a group member.

await sock.setLabelGroup(jid, string);

Retrieve Channel ID

Fetch the channel identifier from a given URL.

await sock.newsletterFromUrl(url);

Response JSON:

{
  "name": "Channel Name",
  "id": "Channel ID",
  "state": "Channel Status",
  "subscribers": "Subscriber Count",
  "verification": "UNVERIFIED",
  "creation_time": 1728547155,
  "description": "Channel Description"
}

Check Banned Number

Verify whether a given number has been blocked or banned.

sock.checkWhatsApp(jid);

SendMessage Reference

Status Mention — Group & Private

Dispatch a status mention to a group or private conversation.

await sock.sendStatusMention(content, jid);

Group Status Message (V2)

Send a group status using the Version 2 protocol.

await sock.sendMessage(jid, {
  groupStatusMessage: {
    text: "Your group status message here.",
  },
});

Album Message (Multiple Images)

Deliver multiple images as a single cohesive album.

await sock.sendMessage(jid, {
  albumMessage: [
    {
      image: IMAGE,
      caption: "First image caption",
    },
    {
      image: { url: "YOUR_IMAGE_URL" },
      caption: "Second image caption",
    },
  ],
}, { quoted: m });

Event Message

Compose and dispatch a WhatsApp event invitation.

await sock.sendMessage(jid, {
  eventMessage: {
    isCanceled: false,
    name: "Your Event Name",
    description: "A brief description of your event.",
    location: {
      degreesLatitude: 0,
      degreesLongitude: 0,
      name: "Event Location",
    },
    joinLink: "https://call.whatsapp.com/video/your-link",
    startTime: "1763019000",
    endTime: "1763026200",
    extraGuestsAllowed: false,
  },
}, { quoted: m });

Poll Result Message

Render poll results alongside their respective vote tallies.

await sock.sendMessage(jid, {
  pollResultMessage: {
    name: "Your Poll Title",
    pollVotes: [
      {
        optionName: "Option A",
        optionVoteCount: "2"
      },
      {
        optionName: "Option B",
        optionVoteCount: "1"
      }
    ]
  }
}, { quoted: m });

Simple Interactive Message

Send a straightforward interactive message featuring a copy-to-clipboard button.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: "Message Header",
    title: "Message Title",
    footer: "telegram: @fanzxnothuman",
    buttons: [
      {
        name: "cta_copy",
        buttonParamsJson: JSON.stringify({
          display_text: "Copy Code",
          id: "123456789",
          copy_code: "YOUR_CODE_HERE"
        })
      }
    ]
  }
}, { quoted: m });

Interactive Message with Native Flow

Send a feature-rich interactive message incorporating buttons, copy actions, and native flow elements.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: "Message Header",
    title: "Message Title",
    footer: "telegram: @fanzxnothuman",
    image: { url: "https://example.com/image.jpg" },
    nativeFlowMessage: {
      messageParamsJson: JSON.stringify({
        limited_time_offer: {
          text: "Your promotional text here.",
          url: "https://t.me/fanzxnothuman",
          copy_code: "YOUR_CODE",
          expiration_time: Date.now() * 999
        },
        bottom_sheet: {
          in_thread_buttons_limit: 2,
          divider_indices: [1, 2, 3, 4, 5, 999],
          list_title: "List Title",
          button_title: "Button Label"
        },
        tap_target_configuration: {
          title: "Target Title",
          description: "Target description.",
          canonical_url: "https://t.me/fanzxnothuman",
          domain: "example.com",
          button_index: 0
        }
      }),
      buttons: [
        {
          name: "single_select",
          buttonParamsJson: JSON.stringify({
            has_multiple_buttons: true
          })
        },
        {
          name: "call_permission_request",
          buttonParamsJson: JSON.stringify({
            has_multiple_buttons: true
          })
        },
        {
          name: "single_select",
          buttonParamsJson: JSON.stringify({
            title: "Select an Option",
            sections: [
              {
                title: "Category",
                highlight_label: "Label",
                rows: [
                  {
                    title: "First Option",
                    description: "Option description.",
                    id: "row_1"
                  }
                ]
              }
            ],
            has_multiple_buttons: true
          })
        },
        {
          name: "cta_copy",
          buttonParamsJson: JSON.stringify({
            display_text: "Copy Code",
            id: "123456789",
            copy_code: "YOUR_CODE"
          })
        }
      ]
    }
  }
}, { quoted: m });

Interactive Message with Thumbnail

Send an interactive message accompanied by a thumbnail image and a copy button.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: "Message Header",
    title: "Message Title",
    footer: "telegram: @fanzxnothuman",
    image: { url: "https://example.com/image.jpg" },
    buttons: [
      {
        name: "cta_copy",
        buttonParamsJson: JSON.stringify({
          display_text: "Copy Code",
          id: "123456789",
          copy_code: "YOUR_CODE"
        })
      }
    ]
  }
}, { quoted: m });

Product Message

Dispatch a product catalog message complete with merchant details and action buttons.

await sock.sendMessage(jid, {
  productMessage: {
    title: "Product Name",
    description: "A concise description of the product.",
    thumbnail: { url: "https://example.com/image.jpg" },
    productId: "PROD001",
    retailerId: "RETAIL001",
    url: "https://example.com/product",
    body: "Full product details.",
    footer: "Special pricing available.",
    priceAmount1000: 50000,
    currencyCode: "IDR",
    buttons: [
      {
        name: "cta_url",
        buttonParamsJson: JSON.stringify({
          display_text: "Purchase Now",
          url: "https://example.com/buy"
        })
      }
    ]
  }
}, { quoted: m });

Interactive Message with Document Buffer

Send an interactive message with a document loaded from the file system. Note: Document attachments exclusively support buffer input.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: "Message Header",
    title: "Message Title",
    footer: "telegram: @fanzxnothuman",
    document: fs.readFileSync("./package.json"),
    mimetype: "application/pdf",
    fileName: "document.pdf",
    jpegThumbnail: fs.readFileSync("./thumbnail.jpeg"),
    contextInfo: {
      mentionedJid: [jid],
      forwardingScore: 777,
      isForwarded: false
    },
    externalAdReply: {
      title: "Your Bot Name",
      body: "Your bot description.",
      mediaType: 3,
      thumbnailUrl: "https://example.com/image.jpg",
      mediaUrl: "https://example.com",
      sourceUrl: "https://t.me/fanzxnothuman",
      showAdAttribution: true,
      renderLargerThumbnail: false
    },
    buttons: [
      {
        name: "cta_url",
        buttonParamsJson: JSON.stringify({
          display_text: "Telegram",
          url: "https://t.me/fanzxnothuman",
          merchant_url: "https://t.me/fanzxnothuman"
        })
      }
    ]
  }
}, { quoted: m });

Interactive Message with Document Buffer (Minimal)

A streamlined variant without contextInfo or externalAdReply. Note: Document attachments exclusively support buffer input.

await sock.sendMessage(jid, {
  interactiveMessage: {
    header: "Message Header",
    title: "Message Title",
    footer: "telegram: @fanzxnothuman",
    document: fs.readFileSync("./package.json"),
    mimetype: "application/pdf",
    fileName: "document.pdf",
    jpegThumbnail: fs.readFileSync("./thumbnail.jpeg"),
    buttons: [
      {
        name: "cta_url",
        buttonParamsJson: JSON.stringify({
          display_text: "Telegram",
          url: "https://t.me/fanzxnothuman",
          merchant_url: "https://t.me/fanzxnothuman"
        })
      }
    ]
  }
}, { quoted: m });

Request Payment Message

Initiate a payment request with a custom background configuration and sticker attachment.

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

await sock.sendMessage(jid, {
  requestPaymentMessage: {
    currency: 'IDR',
    amount: 10000000,
    from: m.sender,
    sticker: JSON.parse(quotedContent),
    background: {
      id: '100',
      fileLength: '0',
      width: 1000,
      height: 1000,
      mimetype: 'image/webp',
      placeholderArgb: 0xff00ffff,
      textArgb: 0xffffffff,
      subtextArgb: 0xffaa00ff
    }
  }
}, { quoted: m });

Why WhatsApp Baileys?

This library stands out for its exceptional stability, comprehensive feature set, and a continuously refined pairing mechanism. It is the preferred choice for developers building professional-grade, secure WhatsApp automation solutions. Ongoing support for the latest WhatsApp capabilities ensures long-term compatibility and future-proofing.


Technical Notes

  • Custom pairing codes with proven stability and security
  • Resolves known authentication and pairing failure edge cases
  • Interactive messages and action buttons for sophisticated dynamic menus
  • Automated, low-overhead session management for sustained uptime
  • Full multi-device support aligned with WhatsApp's latest specifications
  • Modular design enabling straightforward customization and extensibility
  • Well-suited for bots, customer service automation, and enterprise communication tooling
  • Subscribe to the official WhatsApp Channel for updates: WhatsApp Channel

For complete documentation, installation instructions, and implementation references, visit the official repository and community forums. This library is under active development, with continuous improvements driven by real-world developer needs.

Thank you for choosing WhatsApp Baileys as your WhatsApp automation foundation.


Contact

For inquiries, support, or collaboration opportunities:

🙌 Contributors

Recognition to the following contributors who have helped shape this project: