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

jeast-whatsapp-api

v1.1.4

Published

Useful tools for whatsapp

Readme

npm license Jeast_Whatsapp_Api-1.1.4 stars stars

Jeast Whatsapp API

A Simple whatsapp api that connects through the whatsapp web, that is used for all needs such as sending messages, and authenticating on whatsapp via qr code.

🚀 Installation

Type the npm command below to install the package

npm i jeast-whatsapp-api

or

yarn add jeast-whatsapp-api

Please note that Node v12+ is required.

⭕ Basic usage

const { Jeast } = require("jeast-whatsapp-api");

const client = new Jeast();

//Make connection state for get qr code and save session!
client.connect({
  logger: true,
  qr_terminal: true,
  headless: true,
  authState: {
    isAuth: true,
    authId: "example_account",
  },
});

//Event listener for get QR code!
client.ev.qr(async (qr) => {
  if (qr) {
    console.log(qr);
  }
});

//Event listener that which be called if authenticated!
client.ev.connection(async (connection) => {
  if (connection.isConnected) {
    console.log("connected!");
  }
});

//Event listeners that which be called if someone sending message for you!
client.ev.message(async (message) => {
  if (message.body == "Hello") {
    await client.sendMessage(message.id.remote, "Hai");
  }
});

Jeast Whatsapp API has various functions, there are several functions that are not tied to existing events, so we will provide documentation of these functions below

📹 Events Listeners

This is a some event listener that return a callback

const { Jeast } = require("jeast-whatsapp-api");

const client = new Jeast();

client.ev.qr(callback);
//Event listener to get or print qr code
client.ev.changeState(callback);
//Event listener that which will be called if state has been changed
client.ev.connection(callback);
//Event listener that which will be called when connected or authenticated
client.ev.message(callback);
//Event listener that which will be called when some peoples send message
client.ev.newMessage(callback);
//Event listener will be called if new message has been created
client.ev.revokeMe(callback);
//Event listener that which will be called when some peoples revoke to you
client.ev.revokeAll(callback);
//Event listener that which will be called when revoke all related to you
client.ev.uploadMedia(callback);
//Event listener that will be called if you are sending a message
client.ev.incomingCall(callback);
//Event listener will be called when someone calls you with whatsapp
client.ev.group.join(callback);
//Event listener will be called when someone invite you on group
client.ev.group.leave(callback);
//Event listener will be called when someone remove you from group
client.ev.group.update(callback);
//Event listener will be called when someone update same group as you

💬 Sending Message

This is a function to send a message

const options = {
  sendAudioAsVoice: Boolean, // make it true if you use this options
  sendVideoAsGif: Boolean, // make it true if you use this options
  sendAsSticker: Boolean, // make it true if you use this options
  sendAsDocument: Boolean, // make it true if you use this options
};

sendMessage("[email protected]", "message", options); // asynchronous function

📨 Get Chat List

This is a function to get all chat list

getChats(); // asynchronous function

📌 Pin Chat By Id

This is a function to pin chat using specified id

pinChatById("[email protected]"); // asynchronous function

📌 Unpin Chat By Id

This is a function to unpin chat using specified id

unpinChatById("[email protected]"); // asynchronous function

🔇 Mute Chat

This is a function to mute chat

muteChat("[email protected]"); // asynchronous function

📤 Mark Chat as Unread

This is a function to mark as unread chat

markChatAsUnread("[email protected]"); // asynchronous function

🚪 Logout

This is a function to logout from the whatsapp web

logout(); // asynchronous function

🔎 Search Messages

This is a function to search messages with query type string

  const options = {
    page: number; // fill in how many messages the message page will retrieve
    limit: number; // fill in how many messages are limited
    chatId: string; // fill in the recipient's chat id
  }

  searchMessages(query = 'string', options); // asynchronous function

👀 Send Seen

This is a function to send message seen

sendMessageSeen("[email protected]"); // asynchronous function

📩 Get Chat By Id

This is a function to get chat using chat id

getChatById("[email protected]"); // asynchronous function

🔢 Get Phone Country Code

This is a function to get chat using chat id

getPhoneCountry("phone-number"); // asynchronous function

🏫 Create New Group

This is a function to create new group and add some participants

createNewGroup("Test", ["List of participant number id"]); // asynchronous function

📟 Get Whatsapp Version

This is a function to get whatsapp version

getWAVersion(); // asynchronous function

🗄️ Archive Message

This is a function for archive message by chat id

addToArchive("[email protected]"); // asynchronous function

❌🗄️ Remove Message From Archive

This is a function for remove message from archive by chat id

removeFromArchive("[email protected]"); // asynchronous function

📠 Get Contacts

This is a function to get all contacts

getContacts(); // asynchronous function

🏷️ Get Labels

This is a function to get all labels

getLabels(); // asynchronous function

🏷️ Get Chat By Label

This is a function to get chat by label id

getChatsByLabel("labelId"); // asynchronous function

📠 Get All Blocked Contacts

This is a function to get all of blocked contacts

getBlocked()(); // asynchronous function

🖼 Send as Sticker

const { Jeast, MsgMedia } = require("jeast-whatsapp-api");

const client = new Jeast();

client.connect({
  logger: true,
  qr_terminal: true,
  headless: true,
  authState: {
    isAuth: true,
    authId: "example_account",
  },
});

client.ev.qr(async (qr) => {
  if (qr) {
    console.log(qr);
  }
});

client.ev.connection(async (connection) => {
  if (connection.isConnected) {
    const sticker = MsgMedia.fromFilePath(__dirname + "/path/to/file");
    await client.sendMessage("[email protected]", sticker, {
      sendAsSticker: true,
    });
  }
});

🖻 Send as Document

const { Jeast, MsgMedia } = require("jeast-whatsapp-api");

const client = new Jeast();

client.connect({
  logger: true,
  qr_terminal: true,
  headless: true,
  authState: {
    isAuth: true,
    authId: "example_account",
  },
});

client.ev.qr(async (qr) => {
  if (qr) {
    console.log(qr);
  }
});

client.ev.connection(async (connection) => {
  if (connection.isConnected) {
    const document = MsgMedia.fromFilePath(__dirname + "/path/to/file");
    await client.sendMessage("[email protected]", document, {
      sendAsDocument: true,
    });
  }
});

👾 Send Video as Gif

const { Jeast, MsgMedia } = require("jeast-whatsapp-api");

const client = new Jeast();

client.connect({
  logger: true,
  executablePath: "/path/to/chrome", //use executablePath to send video or gif
  qr_terminal: true,
  headless: true,
  authState: {
    isAuth: true,
    authId: "example_account",
  },
});

client.ev.qr(async (qr) => {
  if (qr) {
    console.log(qr);
  }
});

client.ev.connection(async (connection) => {
  if (connection.isConnected) {
    const video = MsgMedia.fromFilePath(__dirname + "/path/to/file");
    await client.sendMessage("[email protected]", video, {
      sendVideoAsGif: true,
    });
  }
});

📑 License

MIT License

Copyright (c) 2022 Ferdian Satria Akbar

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.