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

@gilangf3000/bailis

v7.0.0-rc.10

Published

Bailis: a lightweight WebSockets library for interacting with WhatsApp Web (forked from Baileys)

Readme

Bailis

Bailis adalah library WebSocket ringan untuk berinteraksi dengan WhatsApp Web (fork dari Baileys). Dokumentasi ini versi Bahasa Indonesia dan berfokus pada penggunaan praktis yang paling sering dipakai.

Instalasi

Dengan npm:

npm i @gilangf3000/bailis

Dengan yarn:

yarn add @gilangf3000/bailis

Quick Start

import makeWASocket, {
  DisconnectReason,
  fetchLatestBaileysVersion,
  useMultiFileAuthState
} from '@gilangf3000/bailis'

const startSock = async () => {
  const { state, saveCreds } = await useMultiFileAuthState('auth')
  const { version } = await fetchLatestBaileysVersion()

  const sock = makeWASocket({
    version,
    auth: state,
  })

  sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
    if (connection === 'close') {
      const statusCode = (lastDisconnect?.error as any)?.output?.statusCode
      if (statusCode !== DisconnectReason.loggedOut) {
        startSock()
      }
    }
  })

  sock.ev.on('creds.update', saveCreds)
}

startSock()

Autentikasi

Gunakan useMultiFileAuthState untuk menyimpan kredensial secara aman dan mudah:

import { useMultiFileAuthState } from '@gilangf3000/bailis'

const { state, saveCreds } = await useMultiFileAuthState('auth')

In-Memory Store

Bailis menyediakan store in-memory (mirip Baileys upstream) untuk menyimpan chat, kontak, pesan, metadata grup, label, dll.

import makeWASocket, { makeInMemoryStore } from '@gilangf3000/bailis'

const store = makeInMemoryStore({})
store.readFromFile('./baileys_store.json')

setInterval(() => {
  store.writeToFile('./baileys_store.json')
}, 10_000)

const sock = makeWASocket({ /* config */ })
store.bind(sock.ev)

Catatan penting

  • Store hanya menyimpan data yang pernah diterima oleh socket atau dibaca dari file.
  • Untuk history lengkap, pastikan syncFullHistory: true dan shouldSyncHistoryMessage: () => true.

History Sync

History akan masuk lewat event messaging-history.set.

const sock = makeWASocket({
  // ...
  syncFullHistory: true,
  shouldSyncHistoryMessage: () => true,
})

Kirim Pesan

await sock.sendMessage('[email protected]', { text: 'Halo!' })

Ambil Pesan dari Store

const msgs = await store.loadMessages('[email protected]', 25)
console.log(msgs)

Event Penting

  • connection.update
  • creds.update
  • messaging-history.set
  • messages.upsert
  • messages.update
  • messages.delete
  • chats.upsert, chats.update, chats.delete
  • contacts.upsert, contacts.update
  • presence.update
  • messages.reaction
  • message-receipt.update

Media

Untuk upload/download media, gunakan helper di Utils. Contoh umum:

import { downloadMediaMessage } from '@gilangf3000/bailis'

const buffer = await downloadMediaMessage(msg, 'buffer')

Troubleshooting

  • Jika login gagal, hapus folder auth lalu login ulang.
  • Jika sering disconnect, gunakan fetchLatestBaileysVersion() dan update versi.
  • Hindari menyimpan semua history di memori jika skala besar, gunakan database sendiri.

Build

npm run build

Bailis menggunakan build ESM:

  • lib/index.js

Lisensi

MIT