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 🙏

© 2024 – Pkg Stats / Ryan Hefner

whatsapp-socket.js

v1.3.0

Published

An unofficial WhatsApp API using [baileys](https://github.com/whiskeysockets/baileys) implemented into [whatsapp-web.js](https://github.com/pedroslopez/whatsapp-web.js).

Downloads

6

Readme

WASocketJS

An unofficial WhatsApp API using baileys implemented into whatsapp-web.js.

You can use all the features here like you use whatsapp-web.js with the help of the main library, baileys.

PLEASE NOTE

I cannot guarantee that you can always use this library safely because the threat from WhatsApp to users who use unofficial WhatsApp API services is the possibility of an account ban/blocking for those who engage in such actions, and this ban can be for a significant period. So, use this at your own risk.

Get started

To get started, first, you need to install this library using npm/yarn/pnpm.

NPM

npm install whatsapp-socket.js

Yarn

yarn add whatsapp-socket.js

PNPM

pnpm install whatsapp-socket.js

If you have installed the library, you can create a JavaScript file and fill it with the following code.

const { Client } = require("whatsapp-socket.js");

const client = new Client({ sessionName: "wsocketjs" });
client.initialize();
client.on("qr", (qr) => {
    console.log("QR RECEIVED " + qr)
});
client.on("ready", (msg) => console.log(msg));
client.on("message", (msg) => {
    if (msg.body == "#ping") {
        msg.reply("pong!");
    }
});

A brief explanation: You need to import the client class from the library and initialize it with the available variable (const client = new Client()). After that, use events to obtain some data from the WhatsApp server connection.

Options

There are several options available in this library.

/** Client options */
interface ClientOptions {
    /** Session name of client */
    sessionName: string;
    /** If true, the bot can reply their message */
    self: boolean;
    /** Interval that set of store when the message is stored. Default 10s */
    intervalStore: number;
}

/** Message send options */
interface MessageOptions {
    /** If true, all the text/caption of message will be parsed to get the mentions text */
    parseMention?: boolean;
    /** Send message with mentions with specific jid */
    mentions?: string[];
    /** If you want to send message with replied/quoted, fill this option with message id */
    quotedMsgId?: string;
    /** If the content is MessageMedia, it would be recommended */
    mimetype?: Mimetype;
    /** If the content is MessageMedia, it would be recommended */
    caption?: string;
    /** Sticker metadata (if it set, the media will be sent as sticker) */
    sticker?: StickerData;
    /** Extra options */
    extra?: any;
}

For more details, you can refer to index.d.ts.

i need more time to create this documentation (⁠╥⁠﹏⁠╥⁠) you can open issues if there is any problem/solution the 'alternative documentation' availabel in example.js