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

@neelegirly/wa-api

v1.8.1

Published

Neelegirly multi-session wrapper API for @neelegirly/baileys (WhatsApp Web)

Readme

💌 @neelegirly/wa-api 💌

Multi-Session WhatsApp – jetzt mit echtem Lifecycle-Management

QR · Pairing · Pause/Resume · PM2-Ready · Update Notify

Version Baileys Libsignal Downloader npm

Installation · Quickstart · Lifecycle · Storage · API · Release Notes


✨ Was ist @neelegirly/wa-api?

@neelegirly/wa-api ist die komfortable Multi-Session-Schicht über @neelegirly/baileys. Der Wrapper nimmt dir den nervigen Teil ab: Session-Lifecycle, Credential-Handling, QR-/Pairing-Callbacks, Update-Status und PM2-freundliches Wiederanlaufen nach Neustarts.

Highlights auf einen Blick

| Feature | Beschreibung | Status | |---------|--------------|--------| | 🔀 Managed Multi-Session | Mehrere Sessions parallel inklusive Registry und Offline-Sicht | ✅ | | ⏯️ Lifecycle API | start, pause, stop, resume, delete pro Session | ✅ | | 💾 Credential-Migration | Standard ist jetzt _neelegirly, Legacy _credentials_neelegirly und _credentials bleiben kompatibel | ✅ | | 🧠 PM2 Ready | desiredState, autoStart und loadSessionsFromStorage() für Warm-Restarts | ✅ | | 🔔 Update Notify | Wrapper- und Baileys-Status im Start- und QR-Flow | ✅ | | 📱 QR & Pairing | QR-Login, Pairing-Code, Retry-Limits und Callbacks | ✅ |


🆕 Was sich in v1.8.1 geändert hat

  • ✅ Neues Session-Lifecycle-Management mit pauseSession(), stopSession(), resumeSession() und deleteSession()
  • ✅ Persistente Session-Registry über wa_credentials/.neelegirly-session-registry.json
  • ✅ Neuer Credential-Standard: ${sessionId}_neelegirly
  • ✅ Alte _credentials_neelegirly- und _credentials-Ordner werden weiter erkannt und bei Bedarf sauber migriert
  • getSessionInfo(), getSessionStatus() und getAllManagedSessions() für Runtime- und Offline-Status
  • ✅ Verbesserter Update-Check für @neelegirly/wa-api und @neelegirly/baileys
  • ✅ PM2-freundliches Autostart-Verhalten über desiredState statt blindem Dauer-Reconnect

🚀 Installation

npm

npm install @neelegirly/[email protected] @neelegirly/[email protected] @neelegirly/[email protected] @neelegirly/[email protected] --save-exact

yarn

yarn add @neelegirly/[email protected] @neelegirly/[email protected] @neelegirly/[email protected] @neelegirly/[email protected] --exact

pnpm

pnpm add @neelegirly/[email protected] @neelegirly/[email protected] @neelegirly/[email protected] @neelegirly/[email protected] --save-exact

Import

const waApi = require('@neelegirly/wa-api')
import * as waApi from '@neelegirly/wa-api'

Der empfohlene Stack für diesen Release ist: 1.8.1 / 2.2.18 / 1.0.28 / 0.1.65.


📖 Quickstart

const waApi = require('@neelegirly/wa-api')

waApi.onConnected((sessionId) => {
  console.log(`✅ ${sessionId} ist verbunden`)
})

waApi.onMessageReceived(async (msg) => {
  const text = msg.message?.conversation || msg.message?.extendedTextMessage?.text || ''
  const jid = msg.key?.remoteJid

  if (!jid) return

  if (text.toLowerCase() === 'ping') {
    await waApi.sendMessage(msg.sessionId, jid, {
      text: 'pong 💖 aus dem Neelegirly Glow-up'
    })
  }
})

async function boot() {
  await waApi.checkForUpdates()

  await waApi.startSession('main-session', {
    printQR: true,
    autoStart: true,
    retryLimit: 10
  })
}

boot().catch(console.error)

PM2 / Warm-Restart

async function restoreSessions() {
  const restored = await waApi.loadSessionsFromStorage()
  console.log('♻️ Wiederhergestellt:', restored)
}

restoreSessions().catch(console.error)

loadSessionsFromStorage() startet nur Sessions neu, deren desiredState auf running steht. Pausierte oder gestoppte Sessions bleiben also auch nach einem Neustart absichtlich ruhig. Kleine Sache, große Wirkung.


📲 Session Management

await waApi.startSession('sales', {
  printQR: true,
  autoStart: true
})

await waApi.startSessionWithPairingCode('support', {
  phoneNumber: '491234567890',
  autoStart: true
})

await waApi.pauseSession('sales')
await waApi.resumeSession('sales')
await waApi.stopSession('support')

const info = waApi.getSessionInfo('sales')
const status = waApi.getSessionStatus('support')
const managed = waApi.getAllManagedSessions()

console.log(info, status, managed)

await waApi.deleteSession('support')

Lifecycle-Status

| Status | Bedeutung | |--------|-----------| | new | Session ist bekannt, aber noch nie erfolgreich gestartet worden | | starting | Start wurde ausgelöst, QR/Initialisierung läuft | | connecting | Socket verbindet sich oder retryt gerade | | running | Session ist online | | paused | Session wurde bewusst pausiert und bleibt aus | | stopped | Session wurde bewusst gestoppt und bleibt aus | | deleted | Session und Credentials wurden entfernt | | error | Session hat einen Fehlerzustand erreicht |


💾 Storage & Credential-Migration

  • Credential-Root bleibt wa_credentials
  • Neuer Standard-Ordnername: ${sessionId}_neelegirly
  • Legacy-Ordner ${sessionId}_credentials_neelegirly und ${sessionId}_credentials werden weiterhin erkannt
  • Falls nötig, werden Legacy-Ordner automatisch in das neue Schema überführt
  • Leere Credential-Ordner werden ignoriert, damit keine Phantom-Sessions entstehen
  • Die Session-Registry liegt in wa_credentials/.neelegirly-session-registry.json

deleteSession() entfernt sowohl neue als auch alte Credential-Ordner. pauseSession() und stopSession() behalten die Credentials dagegen bewusst bei.


🎧 Event Listener

waApi.onQRUpdated(({ sessionId, qr }) => {
  console.log('📱 Neuer QR-Code für', sessionId)
  console.log(qr)
})

waApi.onPairingCode((sessionId, code) => {
  console.log('🔑 Pairing-Code:', sessionId, code)
})

waApi.onConnecting((sessionId) => {
  console.log('🟡 Verbinde:', sessionId)
})

waApi.onDisconnected((sessionId) => {
  console.log('🔴 Getrennt:', sessionId)
})

Verfügbare Listener:

  • onMessageReceived(listener)
  • onMessageUpdate(listener)
  • onQRUpdated(listener)
  • onConnected(listener)
  • onDisconnected(listener)
  • onConnecting(listener)
  • onPairingCode(listener)

🔔 Update Notify

const snapshot = await waApi.checkForUpdates({ force: true })

console.log(snapshot.waApi)
console.log(snapshot.baileys)
console.log(waApi.getUpdateStatus())
  • checkForUpdates() prüft @neelegirly/wa-api und @neelegirly/baileys
  • npm wird bevorzugt, GitHub dient als Fallback
  • Das Ergebnis wird gecacht, kann aber mit { force: true } neu geladen werden
  • Der Wrapper setzt automatisch Branding-Kontext für QR- und Statusausgaben im Baileys-Stack

📚 API Overview

| Funktion | Beschreibung | |----------|--------------| | checkForUpdates(options?) | Prüft Wrapper- und Baileys-Versionen | | getUpdateStatus() | Liefert den zuletzt gecachten Update-Snapshot | | startSession(id, options) | Startet eine Session via QR oder options.method | | startWhatsapp(id, options) | Veralteter Alias für startSession() | | startSessionWithPairingCode(id, options) | Startet eine Session direkt per Pairing-Code | | pauseSession(id) | Pausiert eine Session ohne Credentials zu löschen | | stopSession(id) | Stoppt eine Session ohne Credentials zu löschen | | resumeSession(id, options?) | Startet eine pausierte/gestoppte Session erneut | | deleteSession(id) | Löscht Session, Registry-Eintrag und Credentials | | getAllSession() | Listet aktuell online laufende Sessions | | getSession(id) | Liefert den aktiven Socket einer Session | | getSessionInfo(id) | Liefert detaillierte Session-Metadaten | | getSessionStatus(id) | Liefert nur den Lifecycle-Status | | getAllManagedSessions() | Listet alle bekannten Sessions, auch offline | | loadSessionsFromStorage() | Stellt autostartbare Sessions nach Neustart wieder her | | sendMessage(sessionId, jid, content, options) | Sendet Nachrichten über eine Session |

Unterstützte Content-Typen

  • { text: string }
  • { image: { url: string }, caption?: string }
  • { video: { url: string }, caption?: string, gifPlayback?: boolean }
  • { audio: Stream, mimetype: string, ptt?: boolean }
  • { document: { url: string, filename?: string }, mimetype: string }
  • { poll: { name: string, values: string[], selectableCount: number } }
  • { react: { text: string, key: MessageKey } }
  • { delete: MessageKey }
  • { pin: { type: number, time: number, key: MessageKey } }
  • { contacts: { displayName: string, contacts: Array } }
  • { location: { degreesLatitude: number, degreesLongitude: number } }
  • { forward: Message }

⚠️ Wichtige Hinweise

Diese Library ist ausschließlich für @neelegirly/baileys gedacht.

  • ✖️ Kein Spam oder Missbrauch
  • ✖️ Keine unerlaubte Überwachung oder Stalkerware
  • ✔️ Session-Dateien und creds.json immer privat halten
  • ✔️ Für frische Pairing-Boots muss eine phoneNumber gesetzt sein
  • ✔️ pauseSession()/stopSession() behalten Credentials, deleteSession() räumt komplett auf

📝 Release Notes 1.8.1

  • 💖 Echter Session-Lifecycle statt nur „an oder aus“
  • 🧠 Persistente Registry für PM2- und Restart-freundliches Verhalten
  • 🗂️ Default-Credential-Suffix auf _neelegirly korrigiert
  • 🔁 Legacy-Credential-Ordner _credentials_neelegirly und _credentials bleiben kompatibel und werden migriert
  • 🔔 Update-Notify jetzt wrapper- und baileys-aware
  • ✨ README auf neuen Runtime-Stand, Storage-Flow und API-Surface gebracht

GitHub npm

© 2026 – @neelegirly/wa-api