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

zexxo-baileys

v1.2.2

Published

๐Ÿš€ Zexxo Baileys Core โ€” High-performance WhatsApp MD library. Optimized for speed, reliability, and broad compatibility.

Readme

zexxo-baileys Modern JS (CommonJS)

Zexxo Baileys


Table of Contents


Tentang

zexxo-baileys adalah build JavaScript (CommonJS) dengan struktur rapi dan fokus ke stabilitas session:

  • dist/index.js -> entry utama + banner
  • dist/core/* -> core engine (Socket, Utils, Types, Store, dll)
  • dist/extra/* -> fitur tambahan (multi-session & auth multi-file)

Auto-reconnect tersedia (best-effort): saat koneksi putus karena jaringan / rate limit, sistem akan coba connect ulang otomatis dengan backoff.

Catatan penting: tidak ada sistem yang bisa menjamin 100% anti logout karena WA server & kebijakan perangkat bisa memaksa logout. Yang dibangun di sini: persistence session + reconnect manager supaya lebih tahan banting.


Fitur

  • JavaScript CommonJS (bukan TypeScript)
  • Auth Multi-File (useMultiFileAuthState) - session disimpan per-file (lebih aman untuk data besar)
  • Multi-session / Multi-sender (createSessionManager) - banyak nomor WA, tiap session isolated
  • Best-effort auto reconnect - reconnect dengan delay/backoff saat close
  • API helper untuk send message dan bulk message

Quick Start

Install (local folder)

npm i

Cara Connect WhatsApp

Ada 2 metode:

  1. QR Code (paling kompatibel)
  2. Pairing Code (hanya kalau socket menyediakan requestPairingCode())

QR Code

const { makeWASocket, useMultiFileAuthState } = require("zexxo-baileys");

(async () => {
  const { state, saveCreds } = useMultiFileAuthState("./sessions/main");

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

  sock.ev.on("creds.update", saveCreds);

  sock.ev.on("connection.update", (u) => {
    if (u.connection === "open") console.log("[OK] Connected");
    if (u.connection === "close") console.log("[OFF] Disconnected");
  });
})();

Cara scan QR:

  1. WhatsApp -> Linked Devices / Perangkat tertaut
  2. Link a device
  3. Scan QR yang muncul di terminal

Pairing Code

Pairing code bersifat conditional: kalau sock.requestPairingCode tidak ada, gunakan QR.

const { makeWASocket, useMultiFileAuthState } = require("zexxo-baileys");

(async () => {
  const { state, saveCreds } = useMultiFileAuthState("./sessions/pairing");

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

  sock.ev.on("creds.update", saveCreds);

  const phoneNumber = "62812xxxxxxx"; // format internasional, tanpa +

  if (typeof sock.requestPairingCode === "function") {
    const code = await sock.requestPairingCode(phoneNumber);
    console.log("[PAIR] Pairing Code:", code);
    console.log("WA -> Linked Devices -> Pair with phone number -> masukkan code di atas.");
  } else {
    console.log("[WARN] Pairing code tidak tersedia. Pakai QR: set printQRInTerminal: true.");
  }
})();

Multi-session

Multi-session cocok buat multi sender (banyak nomor) atau multi bot instance.

const { createSessionManager } = require("zexxo-baileys");

(async () => {
  const manager = createSessionManager({
    sessionsDir: "./sessions",
    defaultSocketConfig: { printQRInTerminal: true },
  });

  manager.ev.on("session.ready", ({ id }) => console.log("[READY]", id));
  manager.ev.on("session.reconnect", ({ id, attempt, delay }) =>
    console.log(`[RECONNECT] ${id} attempt=${attempt} in ${delay}ms`)
  );

  await manager.create("bot-1");
  await manager.create("bot-2");

  await manager.sendMessage("bot-1", "[email protected]", { text: "Hello from bot-1" });

  await manager.sendBulkMessage(
    "bot-1",
    ["[email protected]", "[email protected]"],
    (jid) => ({ text: `Halo ${jid}` })
  );
})();

API

useMultiFileAuthState(folder)

  • Menyimpan session di folder (multi-file).
  • Direkomendasikan untuk stability.

createSessionManager({ sessionsDir, defaultSocketConfig })

Methods:

  • manager.create(sessionId, socketConfig?)
  • manager.getSock(sessionId)
  • manager.sendMessage(sessionId, jid, content, options?)
  • manager.sendBulkMessage(sessionId, jids, contentOrFn)
  • manager.stop(sessionId)

Troubleshooting

QR tidak muncul

  • Pastikan printQRInTerminal: true
  • Jangan jalankan di environment yang memblok output terminal
  • Coba update Node.js versi LTS

Koneksi sering close

  • Ini normal saat jaringan tidak stabil / rate limit
  • Hindari spam / broadcast brutal
  • Pakai VPS stabil, jangan sering restart

Session corrupt / creds error

  • Stop bot
  • Backup folder ./sessions
  • Hapus hanya session yang rusak (bukan semuanya) lalu login ulang

Pairing code tidak ada

  • Tidak semua build/socket menyediakan requestPairingCode()
  • Gunakan QR (paling kompatibel)

Backup sessions

  • Copy folder ./sessions ke storage aman
  • Jangan commit / share session ke publik

Credits

Terima kasih untuk rexxhayanasi yang sudah menyediakan keyeddb dan stack signal/libsignal yang membantu fondasi penyimpanan & kripto pada ekosistem ini.


Zexxo Team XVCT