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

whatsappi

v1.2.1

Published

Baileys Whatsapp library wrapper for easy integration on any NodeJS projects. This library using the latest version of @adiwajshing/baileys library for install and run

Readme

WhatsAppi


Baileys Whatsapp library wrapper for easy integration on any NodeJS projects. This library using the latest version of @adiwajshing/baileys library for install and run

Libraries Used

Usage

Installation

From NPM

npm install --save whatsappi

From YARN

yarn add whatsappi

Power Up New Client

const whatsappi = require('whatsappi');

// Or call using ES
import {
  WhatsappiOptions,
  WhatsappiInstance,
  InstanceConnectionStatus,
  Whatsappi,
  generateUUID
} from 'whatsappi';

// New whatsappi client options
const config: WhatsappiOptions = {
  sessionId: 'whatsappi', // Optional
  sessionName: 'Whatsappi', // Required
  printQRinTerminal: true, // Optional
  ignoreBroadcastMessages: false, // Optional
  ignoreGroupMessages: false, // Optional
  ignoreServerAck: false, // Optional
  markOnlineOnConnect: false, // Optional
  syncFullHistory: true, // Optional
  restartable: true, // Optional
  webhookUrl: 'https://webhook.site/c13e9693-f22b-4531-8ee8-90d18146a2b5', // Optional
  sessionToken: generateUUID(), // Optional
};

// Create new instance of Whatsappi
const whatsappi: Whatsappi = new Whatsappi(config);

// After created instance, start the Whatsappi instance
const client: WhatsappiInstance = await whatsappi.start();

// Use the exposed methods for simplify admin the state of the client
client.onQRUpdate(async (qr: string) => {
    console.log('QR updated from callback', qr);

    // If you require update the instance in the database, is simply using typeorm
    const instance: Instance | null = await client.whatsappiDatabase
      .getRepository(Instance)
      .findOne({
        where: {
          sessionId: client.instanceOptions.sessionId,
        },
      });
    if (instance) {
      instance.qrCode = qr;
      instance.connectionStatus = InstanceConnectionStatus.WAITING_FOR_QR;
      await client.whatsappiDatabase.getRepository(Instance).save(instance);
      console.log('QR updated in database');
      console.log(instance);
    }
  });
  client.onQRScanned(async () => {
    console.log('QR scanned from callback');
    const instance: Instance | null = await client.whatsappiDatabase
      .getRepository(Instance)
      .findOne({
        where: {
          sessionId: client.instanceOptions.sessionId,
        },
      });
    if (instance) {
      instance.qrCode = '';
      instance.connectionStatus = InstanceConnectionStatus.INITIALIZING;
      await client.whatsappiDatabase.getRepository(Instance).save(instance);
      console.log('QR scanned in database');
      console.log(instance);
    }
  });
  client.onLoggedIn(async () => {
    console.log('Logged in from callback');
    // await client.socket.sendMessage('[email protected]', {
    //   text: 'Hello from Whatsappi',
    // });
    const instance: Instance | null = await client.whatsappiDatabase
      .getRepository(Instance)
      .findOne({
        where: {
          sessionId: client.instanceOptions.sessionId,
        },
      });
    if (instance) {
      instance.qrCode = '';
      instance.connectionStatus = InstanceConnectionStatus.CONNECTED;
      await client.whatsappiDatabase.getRepository(Instance).save(instance);
      console.log('Logged in in database');
      console.log(instance);
    }
  });
  client.onEvent('connection.update', (update: any) => {
    console.log('Connection update from callback', update);
  });
}

Whatsappi Interfaces

WhatsappiOptions

Options to create a new Whatsappi instance

// This is a interface of the WhatsappiOptions required to create a new client
import { WhatsappiOptions } from 'whatsappi';

export interface WhatsappiOptions {
  sessionId?: string;
  sessionName: string;
  sessionToken?: string;
  webhookUrl?: string;
  restartable?: boolean;
  printQRinTerminal?: boolean;
  markOnlineOnConnect?: boolean;
  ignoreBroadcastMessages?: boolean;
  ignoreGroupMessages?: boolean;
  ignoreServerAck?: boolean;
  syncFullHistory?: boolean;
}

WhatsappiInstance

The structure of the new client created WhatsappiInstance

// This is a interface of the WhatsappiInstance clients
import { WhatsappiInstance } from 'whatsappi';

export interface WhatsappiInstance {
  instanceOptions: WhatsappiOptions;
  whatsappiDatabase: DataSource;
  socketOptions: UserFacingSocketConfig;
  socket: WASocket;
  store: StoreHandle;
  getStore: StoreHandle;
  onQRUpdate: (callback: (qr: string) => void) => void;
  onQRScanned: (callback: () => void) => void;
  onLoggedIn: (callback: () => void) => void;
  onEvent: (event: string, cb: any) => void;
}

Found an Issue?

Or simply want to add a new feature you have been dreaming of? Submit a new Issue with the correct formation and relax.

For Developers

Want to contribute to the project? Easy,

  1. Find an issue to start with
  2. Fork the project
  3. Make PR
  4. Get merged.

Note

I can't guarantee or can be held responsible if you get blocked or banned by using this software. WhatsApp does not allow bots using unofficial methods on their platform, so this shouldn't be considered totally safe.

Legal

  • This code is in no way affiliated, authorized, maintained, sponsored or endorsed by WA (WhatsApp) or any of its affiliates or subsidiaries.
  • The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
  • This is an independent and unofficial software Use at your own risk.
  • Do not spam people with this.