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

habibi-cloud-baileys

v1.0.2

Published

Custom wrapper modular di atas Baileys: pesan interaktif (Button/List/Carousel via protobuf), message serializer, auto-reconnect, pairing code 8 digit, dan anti memory leak. Dual package (CommonJS + ESM).

Readme

habibi-cloud-baileys

Custom wrapper modular di atas Baileys buat bikin bot WhatsApp. Dirancang sebagai core engine project bot modular dan siap dipublish ke NPM.

Fitur

  • Pesan Interaktif — Button, List Message, dan Carousel via manipulasi Protobuf (native flow).
  • Message Serializer — objek pesan masuk (m) langsung disederhanakan: from, sender, body, quoted, reply(), react(), download(), dll.
  • Auto-Reconnect — nyambung ulang otomatis dengan exponential backoff.
  • Pairing Code 8 Digit — login tanpa scan QR.
  • Anti Memory LeakMemoryManager dengan TTL, LRU eviction, dan sweep otomatis biar RAM server awet.
  • Dual Package — bisa require (CommonJS) dan import (ES Modules) tanpa butuh bundler.

Instalasi

npm install habibi-cloud-baileys

Base engine: @whiskeysockets/baileys@^7.0.0-rc.13 (v7 RC). pino & qrcode-terminal ikut ke-install. Butuh Node.js >= 20.

⚠️ v7 = banyak breaking changes dibanding v6 (auth/pairing, store dihapus, printQRInTerminal dihapus). Library ini sudah disesuaikan: QR di-handle lewat event, dan Baileys dimuat secara robust (otomatis fallback ke dynamic import() kalau v7 ternyata ESM-only).

Ganti base engine (opsional)

Karena Baileys dimuat lewat loader, kamu bisa swap ke fork lain tanpa ubah kode — set env BAILEYS_PACKAGE:

BAILEYS_PACKAGE=ourin-baileys node index.js
# atau pakai paket "baileys" biasa:
BAILEYS_PACKAGE=baileys node index.js

(Pastikan paket pengganti udah ke-install.)

Cara Pakai

CommonJS

const { createBot } = require('habibi-cloud-baileys');

const bot = await createBot({ authFolder: './auth', printQR: true });

bot.on('open', () => console.log('tersambung!'));
bot.on('message', async (m, sock) => {
  if (m.body === 'ping') await m.reply('pong');
});

ES Modules

import { createBot } from 'habibi-cloud-baileys';

const bot = await createBot({ authFolder: './auth' });
bot.on('message', (m) => console.log(m.sender, ':', m.body));

Login pakai Pairing Code

const bot = await createBot({
  usePairingCode: true,
  phoneNumber: '628xxxxxxxxxx', // internasional, tanpa +
});

bot.on('pairing', (code) => console.log('Masukin kode ini di HP:', code));

Pesan Interaktif

// Button
await sock.sendButton(jid, {
  text: 'Pilih:',
  footer: 'footer',
  buttons: [
    { type: 'reply', text: 'Halo', id: 'halo' },
    { type: 'url', text: 'Web', url: 'https://example.com' },
    { type: 'call', text: 'Telp', phone: '628xxx' },
    { type: 'copy', text: 'Copy', copyCode: 'KODE123' },
  ],
});

// List
await sock.sendList(jid, {
  text: 'Menu:',
  buttonText: 'Lihat Menu',
  sections: [{ title: 'Umum', rows: [{ title: 'Ping', id: 'ping' }] }],
});

// Carousel
await sock.sendCarousel(jid, {
  text: 'Geser:',
  cards: [
    { title: 'A', text: 'desc', image: 'https://.../a.jpg', buttons: [{ type: 'reply', text: 'Beli', id: 'a' }] },
  ],
});

Gimana button / nativeflow bisa "muncul"?

Penting: nggak ada flag enableButtons: true di makeWASocket. Dukungan button/list/carousel itu datang dari struktur protobuf pesannya, bukan dari setting socket. Yang dilakukan library ini (di lib/interactive.js):

  1. Pakai proto.Message.InteractiveMessage + nativeFlowMessage (quick_reply, cta_url, single_select, dll).
  2. Bungkus dalam viewOnceMessage + isi messageContextInfo.deviceListMetadataVersion = 2.
  3. Kirim via relayMessage (bukan helper high-level yang sering berubah).
  4. Pakai versi WA Web terbaru via fetchLatestBaileysVersion().

Kombinasi itulah yang bikin server WhatsApp mau me-render tombolnya. Kalau tetap nggak muncul di sebagian device, itu kebijakan sisi WhatsApp (bukan bug library) — coba update versi Baileys/fork, atau pakai fork yang proto-nya lebih baru lewat BAILEYS_PACKAGE.

API Singkat

| API | Keterangan | |-----|------------| | createBot(options) | Bikin instance bot (EventEmitter). | | bot.sock | Socket Baileys + helper sendButton/sendList/sendCarousel. | | bot.memory | Instance MemoryManager. | | bot.stop() | Matiin bot + bersihin resource. | | Event: qr, pairing, connecting, open, close, logout, message, raw, error | |

Opsi createBot

| Opsi | Default | Keterangan | |------|---------|------------| | authFolder | ./auth | Folder kredensial. | | printQR | true | Tampilin QR di terminal. | | usePairingCode | false | Login pakai pairing code. | | phoneNumber | — | Nomor buat pairing code. | | maxReconnectAttempts | Infinity | Batas reconnect. | | memory | {} | Opsi MemoryManager (ttl, maxSize, sweepInterval). |

Publish ke NPM

npm login
# ganti "name" di package.json kalau "habibi-cloud-baileys" udah dipakai orang
npm publish

Lisensi

MIT