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

wertybailz

v1.0.13

Published

A WebSockets library for interacting with WhatsApp Web

Readme

wertybailz

npm version License Downloads

A modern WhatsApp socket wrapper with extended messaging capabilities.


Installation

npm install wertybailz

Or declare in package.json:

"dependencies": {
  "wertybailz": "latest"
}

Import

const {
  default: makeWASocket,
  // other exports
} = require('wertybailz');

Connecting to WhatsApp

Via QR Code

const { default: makeWASocket } = require('wertybailz');

const client = makeWASocket({
  browser: ['Ubuntu', 'Chrome', '20.00.1'],
  printQRInTerminal: true,
});

Via Pairing Code

const {
  default: makeWASocket,
  fetchLatestWAWebVersion,
} = require('wertybailz');

const client = makeWASocket({
  browser: ['Ubuntu', 'Chrome', '20.00.1'],
  printQRInTerminal: false,
  version: fetchLatestWAWebVersion(),
  aiLabel: true, // attaches AI label to outgoing bot messages
});

const number = '628XXXXXXXXX';
const code = await client.requestPairingCode(number.trim());
// For a custom pairing code: client.requestPairingCode(number, 'CUSTOMCODE')

console.log('Pairing code:', code);

Store / Session Data

const {
  default: makeWASocket,
  makeInMemoryStore,
} = require('wertybailz');
const pino = require('pino');

const store = makeInMemoryStore({
  logger: pino().child({ level: 'silent', stream: 'store' }),
});

const client = makeWASocket({ /* options */ });

store.bind(client.ev);

client.ev.on('contacts.upsert', () => {
  console.log('New contacts:', Object.values(store.contacts()));
});

Sending Messages

Order Message

const fs = require('fs');
const thumbnail = fs.readFileSync('./thumbnail.png');

await client.sendMessage(m.chat, {
  thumbnail,
  message: 'Your order summary',
  orderTitle: 'My Store',
  totalAmount1000: 72500,
  totalCurrencyCode: 'IDR',
}, { quoted: m });

Poll Result Snapshot

await client.sendMessage(m.chat, {
  pollResultMessage: {
    name: 'Survey Title',
    options: [
      { optionName: 'Option A' },
      { optionName: 'Option B' },
    ],
    newsletter: {
      newsletterName: 'My Channel',
      newsletterJid: '1@newsletter',
    },
  },
});

Product Message

await client.relayMessage(m.chat, {
  productMessage: {
    title: 'Product Name',
    description: 'Short product description.',
    thumbnail: { url: './product.jpg' },
    productId: 'PRODUCT_ID',
    retailerId: 'RETAILER_ID',
    url: 'https://example.com/product',
    body: 'Body text',
    footer: 'Footer text',
    buttons: [
      {
        name: 'cta_url',
        buttonParamsJson: JSON.stringify({
          display_text: 'View Product',
          url: 'https://example.com/product',
        }),
      },
    ],
    priceAmount1000: 72500,
    currencyCode: 'IDR',
  },
});

Group Member Label

await client.sendMessage(m.chat, {
  groupLabel: {
    labelText: 'Tag group members here',
  },
});

Message to All Group Members

await client.sendMessageMembers(m.chat, {
  extendedTextMessage: {
    text: 'Hello everyone!',
  },
}, {});

Simple Send Helpers

All helpers below support an optional contextInfo and quoted object.

Text

await client.sendText(m.chat, 'Hello world!', {
  contextInfo: { mentionedJid: [m.chat] },
}, {
  key: {
    remoteJid: 'status@broadcast',
    participant: m.sender,
    fromMe: true,
  },
  message: { conversation: '\0' },
});

Image

await client.sendImage(m.chat, { url: './image.jpg' }, 'Caption here', {
  contextInfo: { mentionedJid: [m.chat] },
}, {
  key: {
    remoteJid: 'status@broadcast',
    participant: m.sender,
    fromMe: true,
  },
  message: { conversation: '\0' },
});

Video

await client.sendVideo(m.chat, { url: './video.mp4' }, 'Caption here', {
  contextInfo: { mentionedJid: [m.chat] },
}, {
  key: {
    remoteJid: 'status@broadcast',
    participant: m.sender,
    fromMe: true,
  },
  message: { conversation: '\0' },
});

Audio

await client.sendAudio(m.chat, { url: './audio.mp3' }, {
  contextInfo: { mentionedJid: [m.chat] },
}, {
  key: {
    remoteJid: 'status@broadcast',
    participant: m.sender,
    fromMe: true,
  },
  message: { conversation: '\0' },
});

Location

await client.sendLocation(
  m.chat,
  'Location Name',
  -6.2, 106.8,          // latitude, longitude
  'https://maps.example.com',
  '6281234567890',
  { contextInfo: { mentionedJid: [m.chat] } },
  {
    key: {
      remoteJid: 'status@broadcast',
      participant: m.sender,
      fromMe: true,
    },
    message: { conversation: '\0' },
  }
);

Poll

await client.sendPoll(m.chat, 'Your question?', ['Option 1', 'Option 2', 'Option 3'], true, {
  contextInfo: { mentionedJid: [m.chat] },
}, {
  key: {
    remoteJid: 'status@broadcast',
    participant: m.sender,
    fromMe: true,
  },
  message: { conversation: '\0' },
});

Quiz

await client.sendQuiz(
  m.chat,
  'Which is correct?',
  ['Answer A', 'Answer B', 'Answer C'],
  'Answer B',           // correct answer
  { contextInfo: { mentionedJid: [m.chat] } },
  {
    key: {
      remoteJid: 'status@broadcast',
      participant: m.sender,
      fromMe: true,
    },
    message: { conversation: '\0' },
  }
);

Status Mention

await client.statusMention(m.chat, {
  extendedTextMessage: {
    text: 'Mentioned in status!',
  },
});

License

GPL-3.0