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

@arnabxd/whatspurr

v0.1.9

Published

A grammY-style TypeScript library for WhatsApp, powered by whatsmeow (Go)

Downloads

1,193

Readme

whatspurr

A grammY-style TypeScript library for WhatsApp, powered by whatsmeow (Go) via a WebSocket sidecar.

Documentation | API Reference

Install

bun add @arnabxd/whatspurr

The Go bridge binary is automatically downloaded on first wa.start(). To build from source instead:

bun run build:go

Example

import { WhatsApp } from "@arnabxd/whatspurr";
import { renderUnicodeCompact } from "uqr";

const wa = new WhatsApp({
  sessionDir: "./session",
  logLevel: "info",
});

// QR code event — render for scanning
wa.on("qr", (ctx) => {
  console.log("\nScan this QR code in WhatsApp:\n");
  console.log(renderUnicodeCompact(ctx.qr.code));
});

// Connected
wa.on("connected", (ctx) => {
  console.log(`Connected as ${ctx.connected.jid}`);
});

// Disconnected
wa.on("disconnected", (ctx) => {
  console.log(`Disconnected: ${ctx.disconnected.reason}`);
});

// Echo bot: reply to text messages
wa.on("message:text", async (ctx) => {
  console.log(`${ctx.from}: ${ctx.text}`);
  await ctx.reply(`Echo: ${ctx.text}`);
});

// Start (downloads the Go bridge binary on first run)
await wa.start();

// Graceful shutdown
process.on("SIGINT", async () => {
  await wa.stop();
  process.exit(0);
});

Multi-Session

Run multiple WhatsApp accounts from a single process using WhatsAppManager. All sessions share one Go bridge process and one SQLite database.

import { WhatsAppManager } from "@arnabxd/whatspurr";

const mgr = new WhatsAppManager({ sessionDir: "./session" });
await mgr.start();

// Connect a long-lived listener bot
const bot = await mgr.connect("support-bot");
bot.on("qr", (ctx) => console.log("Scan QR:", ctx.qr.code));
bot.on("message:text", async (ctx) => {
  await ctx.reply("Got it!");
});
await bot.start(); // registers handlers first, then connects

// Connect a sender, do work, disconnect (auth data is preserved)
const sender = await mgr.connect("bulk-sender");
await sender.start();
await sender.api.sendMessage("[email protected]", "Hello!");
await mgr.disconnect("bulk-sender"); // frees resources, can reconnect later

// List all sessions in the database
const sessions = await mgr.list();
// [{ name: "support-bot", jid: "...", connected: true },
//  { name: "bulk-sender", jid: "...", connected: false }]

// Reconnect later without QR (session data is in the DB)
const sender2 = await mgr.connect("bulk-sender");
await sender2.start();

// Remove a session entirely (logout + delete from DB)
await mgr.destroy("bulk-sender");

// Shutdown everything
await mgr.stop();

Session lifecycle

| Method | What happens | Auth data | Can reconnect? | |---|---|---|---| | connect(name) | Prepares a WhatsApp instance with bridge listeners | - | - | | wa.start() | Sends connect_session, starts whatsmeow goroutine | Preserved | - | | disconnect(name) | Disconnects from WhatsApp, stops goroutine | Preserved | Yes (skip QR) | | destroy(name) | Logout from WhatsApp, delete device from DB | Deleted | No (needs re-QR) |

Configuration

const wa = new WhatsApp({
  sessionDir: "./session",              // Session/auth data directory (default: "./session")
  dbName: "whatspurr.db",               // SQLite database filename (default: "whatspurr.db")
  logLevel: "info",                     // debug | info | warn | error
  binaryPath: "/path/to/bridge",        // Use a specific binary (skip auto-download)
  binaryRepo: "ArnabXD/whatspurr",      // GitHub owner/repo for binary downloads
  binaryVersion: "v0.1.0",              // Pin a release version (default: "latest")
  autoPresence: true,                   // Send "available" presence on connect (default: true)
  subscribeOutgoing: false,              // Receive outgoing messages in updates (default: false)
});

Architecture

See the Architecture guide for detailed diagrams covering the startup flow, message lifecycle, middleware engine, WebSocket protocol, and security model.

License

GPL-3.0

Author

ArnabXD