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
Please note that Node v12+ is required.
⭕ Basic usage
const Jeast = require("jeast-whatsapp-api");
const client = new Jeast();
client.on("qr_code", async (qr) => {
if (qr) {
console.log(qr);
}
});
client.on("connection", async (connection) => {
if (connection.isConnected) {
console.log("connected!");
}
});
client.on("message", async (message) => {
if (message.body == "Hello") {
await client.sendMessage(message.id.remote, 'Hai')
}
});
client.connect({
logger: true,
qr_terminal: true,
authState: {
isAuth: true,
authType: "multidevice",
authId: "example_account",
},
});
🖼 Send as Sticker
const { Jeast, MsgMedia } = require("jeast-whatsapp-api");
const client = new Jeast()
const sticker = MsgMedia.fromFilePath(
__dirname + "/path/to/file"
);
await client.sendMessage(message.id.remote, sticker, {
sendAsSticker: true,
});
🖻 Send as Document
const { Jeast, MsgMedia } = require("jeast-whatsapp-api");
const client = new Jeast()
const document = MsgMedia.fromFilePath(
__dirname + "/path/to/file"
);
await client.sendMessage(message.id.remote, document, {
sendAsDocument: true,
});
👾 Send Video as Gif
const { Jeast, MsgMedia } = require("jeast-whatsapp-api");
const client = new Jeast()
const video = MsgMedia.fromFilePath(__dirname + "/path/to/file");
await client.sendMessage(message.id.remote, video, {
sendVideoAsGif: true,
});
client.connect({
logger: true,
executablePath: "/path/to/chrome",
qr_terminal: true,
authState: {
isAuth: true,
authType: "multidevice",
authId: "example_account",
},
});
📑 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.