Giter Site home page Giter Site logo

pranavms13 / whatsapp-node-api Goto Github PK

View Code? Open in Web Editor NEW
454.0 25.0 186.0 273 KB

A Simple NodeJS API Wrapper for WhatsApp

License: Other

JavaScript 98.44% Dockerfile 1.56%
whatsapp whatsapp-web whatsapp-bot whatsapp-api whatsapp-chat bot nodejs-bot heroku nodejs nodejs-wrapper

whatsapp-node-api's Introduction

whatsapp-node-api

Support me on Patreon PayPal

A simple NodeJS Wrapper for whatsapp-web.js by pedroslopez

Technologies UsedWhy?GoalsFAQ

💻 Technologies

Why?

The main reason I decided to build this is that there are many developers who want to play around with Whatsapp API and use them in personal applications before getting/purchasing a Whatsapp Business Account API officially from Whatsapp.

Goals

  • 🚀 Fast!!!

  • 🔒 Does not touch user’s data

  • 💰 Free! for personal use

If you think whatsapp-node-api delivers these, let me know by putting a star ⭐ on this project.

FAQ

  • Is this app built with NodeJS?

Yes, it's built with NodeJS. Please see the Technologies section for more info.

  • What boilerplate did you use?

None. The idea was to get a better understanding of how things work together, But I do take a cue from other projects.

  • What npm modules did you use?

  • express for API Server

  • body-parser Node.js body parser middleware

  • fs To read session.json

  • whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app

  • How do I contact you?

If you find an issue, please report it here. For everything else, please drop me a line at [email protected]

  • Do you have any other projects?

I thought you'd never ask. Yes, I do.

https://github.com/pranavms13

📃 Legal

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk. Commercial use of this code/repo is strictly prohibited.

PR's are welcome

Donate

You can support the maintainer of this project through donation :

Support via PayPal or UPI Donate

👋 Contact Me 👋

Contact me on telegram Mail me

whatsapp-node-api's People

Contributors

azartheen avatar dependabot[bot] avatar immichjs avatar kaoecoito avatar lpanjwani avatar monossido avatar nicosingh avatar pranavms13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whatsapp-node-api's Issues

Send images

has how to send the image by url? Not encoding in base64

Image not sent

Hello friends. Until yesterday I was able to send an image using the code:

const media = MessageMedia.fromFilePath(path.resolve('cardapio1.jpeg'));
client.sendMessage(msg.from, media, { caption: '' || "" });

Today it does not send anymore and does not give any error on the console, it simply does not send and does not point out errors. What can it be?
There is no mistake in the path or in the name of the image, I didn't change anything from yesterday, it just stopped.

Can't send Messages

Hello, good day!,

Thanks by share your api

i try test your api with postman, but i recived this error

dd

How pass the params?

With the get methods i havent problem

dd2

Thanks in advance

please enter valid phone and message

Hello,

I am trying to make sending messages , but it is telling: please enter valid phone and message .
I don't think the issue with the number as it is going through GET. Somehow I think the issue is with the message as it is going through POST.

Below is the code with PHP , please correct me if I am wrong with something.

$data = array('message'=>'test message');
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost:5000/chat/sendmessage/98666669421");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reply=curl_exec($ch);
curl_close($ch);
echo $reply;

Any help with this?

Looking forward

Reading the message

is it possible to read the text of a message? How can I do it?
I'm thinking of using it as a simple bot that expects a "YES" or "NO" answer.

Having a general Endpoint for sending media files

Currently, according to my understanding, there is only 2 type of endpoint available (image & pdf) to send the media files.
But I think there should be a general endpoint for sending all sorts of media files & that endpoint might take media type as an query parameter or even find the media type on its own.

So I think this should solve any further issues in sending different type files, such as this issue here Send contact card (vcard)


For example: (roughly this both endpoints are doing the same thing)

router.post('/sendimage/:phone', async (req,res) => {
var base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
let phone = req.params.phone;
let image = req.body.image;
let caption = req.body.caption;
if (phone == undefined || image == undefined) {
res.send({ status: "error", message: "please enter valid phone and base64/url of image" })
} else {
if (base64regex.test(image)) {
let media = new MessageMedia('image/png',image);
client.sendMessage(`${phone}@c.us`, media, { caption: caption || '' }).then((response) => {
if (response.id.fromMe) {
res.send({ status: 'success', message: `MediaMessage successfully sent to ${phone}` })
}
});
} else if (vuri.isWebUri(image)) {
if (!fs.existsSync('./temp')) {
await fs.mkdirSync('./temp');
}
var path = './temp/' + image.split("/").slice(-1)[0]
mediadownloader(image, path, () => {
let media = MessageMedia.fromFilePath(path);
client.sendMessage(`${phone}@c.us`, media, { caption: caption || '' }).then((response) => {
if (response.id.fromMe) {
res.send({ status: 'success', message: `MediaMessage successfully sent to ${phone}` })
fs.unlinkSync(path)
}
});
})
} else {
res.send({ status:'error', message: 'Invalid URL/Base64 Encoded Media' })
}
}
});
router.post('/sendpdf/:phone', async (req,res) => {
var base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
let phone = req.params.phone;
let pdf = req.body.pdf;
if (phone == undefined || pdf == undefined) {
res.send({ status: "error", message: "please enter valid phone and base64/url of pdf" })
} else {
if (base64regex.test(pdf)) {
let media = new MessageMedia('application/pdf', pdf);
client.sendMessage(`${phone}@c.us`, media).then((response) => {
if (response.id.fromMe) {
res.send({ status: 'success', message: `MediaMessage successfully sent to ${phone}` })
}
});
} else if (vuri.isWebUri(pdf)) {
if (!fs.existsSync('./temp')) {
await fs.mkdirSync('./temp');
}
var path = './temp/' + pdf.split("/").slice(-1)[0]
mediadownloader(pdf, path, () => {
let media = MessageMedia.fromFilePath(path);
client.sendMessage(`${phone}@c.us`, media).then((response) => {
if (response.id.fromMe) {
res.send({ status: 'success', message: `MediaMessage successfully sent to ${phone}` })
fs.unlinkSync(path)
}
});
})
} else {
res.send({ status: 'error', message: 'Invalid URL/Base64 Encoded Media' })
}
}
});

qr code not working

I try to node api.js and run in terminal,then I access ip:5000/auth/getqr ,Qr in that url doesn't work,and every time I refresh,the token in components/last.qr doesn't change

this is the code in api.js
`const express = require("express");
const bodyParser = require("body-parser");
const fs = require("fs");
const axios = require("axios");
const shelljs = require("shelljs");

const config = require("./config.json");
const { Client, LocalAuth } = require("whatsapp-web.js");

process.title = "whatsapp-node-api";
global.client = new Client({
authStrategy: new LocalAuth(),
puppeteer: {
headless: true,
args: ['--no-sandbox']
},
});

global.authed = false;

const app = express();

const port = process.env.PORT || config.port;
//Set Request Size Limit 50 MB
app.use(bodyParser.json({ limit: "50mb" }));

app.use(express.json());
app.use(bodyParser.urlencoded({ extended: true }));

client.on("qr", (qr) => {
console.log("qr");
fs.writeFileSync("./components/last.qr", qr);
});

client.on("authenticated", () => {
console.log("AUTH!");
authed = true;

try {
fs.unlinkSync("./components/last.qr");
} catch (err) {}
});

client.on("auth_failure", () => {
console.log("AUTH Failed !");
process.exit();
});

client.on("ready", () => {
console.log("Client is ready!");
});

client.on("message", async (msg) => {
if (config.webhook.enabled) {
if (msg.hasMedia) {
const attachmentData = await msg.downloadMedia();
msg.attachmentData = attachmentData;
}
axios.post(config.webhook.path, { msg });
}
});
client.on("disconnected", () => {
console.log("disconnected");
});
client.initialize();

const chatRoute = require("./components/chatting");
const groupRoute = require("./components/group");
const authRoute = require("./components/auth");
const contactRoute = require("./components/contact");

app.use(function (req, res, next) {
console.log(req.method + " : " + req.path);
next();
});
app.use("/chat", chatRoute);
app.use("/group", groupRoute);
app.use("/auth", authRoute);
app.use("/contact", contactRoute);

app.listen(port, () => {
console.log("Server Running Live on Port : " + port);
});`

Problem with login in

Since today it isn't login anymore, but I'm also not able to login. I get an error in the whatsapp app that the login is failed. Does anyone else encounter this?

delete media messages / documents

good night, sir. I want to delete media messages / documents on a specific whatsapp number. how can I do it.? please give me an explanation and a few examples. thank you

About new Whatsapp Beta Update

Hi sir,

Whatsapp publish a beta version. we try to scan qr code in this version but its not work. Will you update new whatsapp features ?

POST send message crash after few hours

Hello,

I have this log message after few hours when message try to be send.

POST : /chat/sendmessage/XXXXXXXXX
(node:20153) UnhandledPromiseRejectionWarning: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
at CDPSession.send (/var/www/vhosts/xxxxxxx.ovh/whatsappapi/whatsapp-node-api/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:208:35)
at ExecutionContext._evaluateInternal (/var/www/vhosts/xxxxxxx.ovh/whatsappapi/whatsapp-node-api/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:204:50)
at ExecutionContext.evaluate (/var/www/vhosts/xxxxxxx.ovh/whatsappapi/whatsapp-node-api/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:27)
at DOMWorld.evaluate (/var/www/vhosts/xxxxxxx.ovh/whatsappapi/whatsapp-node-api/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:91:24)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:20153) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 933)

Qr Link GEt Disconnected after node-whatsapp-api crash

npm ERR!
[email protected] start: node api.js
npm ERR! Exit status 1
npm
ERR!
npm
ERR! Failed at the [email protected] start script.
npm
ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!
/root/.npm/_logs/2021-12-30T06_41_42_201Z-debug.log

events.js:174
2|whatsapp | throw er; // Unhandled 'error' event
2|whatsapp | ^
2|whatsapp | Error: socket hang up
2|whatsapp | at createHangUpError (_http_client.js:332:15)
2|whatsapp | at Socket.socketOnEnd (_http_client.js:435:23)
2|whatsapp | at Socket.emit (events.js:203:15)
2|whatsapp | at endReadableNT (_stream_readable.js:1145:12)
2|whatsapp | at process._tickCallback (internal/process/next_tick.js:63:19)
2|whatsapp | Emitted 'error' event at:
2|whatsapp | at Socket.socketOnEnd (_http_client.js:435:9)
2|whatsapp | at Socket.emit (events.js:203:15)
2|whatsapp | at endReadableNT (_stream_readable.js:1145:12)
2|whatsapp | at process._tickCallback (internal/process/next_tick.js:63:19)

Receive Audio and images

Hello, good morning everyone
I configured the webhook and am receiving messages normally.
but how do I receive audio and images?

webhook receive:

"{"msg":
{"mediaKey":"Vv+8mnSBfGOAwWiQmNyqRDivWFLwMjAfzqpMqbRZAas=",
"id":
{"fromMe":false,
"remote":"[email protected]",
"id":"8F2CFF8FF777A0CBF5E3C80767A8D142",
"_serialized":"[email protected]_8F2CFF8FF777A0CBF5E3C80767A8D142"},
"ack":-1,
"hasMedia":true,
"body":"",
"type":"audio",
"timestamp":1619725530,
"from":"[email protected]",
"to":"@c.us",
"author":"@c.us",
"isForwarded":false,
"isStatus":false,
"isStarred":false,
"broadcast":false,
"fromMe":false,
"hasQuotedMsg":false,
"vCards":[],
"mentionedIds":[],
"links":[]}
}"

Receive Message

Ask

How do I get information on receiving a message reply from the message sent?

Failed to Start api.js

Hi, this happen when i try to start api.js

/whatsapp-node-api/node_modules/node-webpmux/webp.js:424
if (!this.data.extended) { this.#convertToExtended(); }
^

SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/semplon/waapi/whatsapp-node-api/node_modules/whatsapp-web.js/src/util/Util.js:8:14)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Error after login

(node:1080) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'default' of undefined
at puppeteer_evaluation_script:5:51
at ExecutionContext._evaluateInternal (D:\Usuario\Desktop\whatsapp\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async ExecutionContext.evaluate (D:\Usuario\Desktop\whatsapp\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:106:16)
at async Client.initialize (D:\Usuario\Desktop\whatsapp\node_modules\whatsapp-web.js\src\Client.js:145:9)
(node:1080) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1080) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate th
e Node.js process with a non-zero exit code.

Error on Post Request

When i use post requst to send messages i get a success message but my whatsapp app is not showing any response or something to show that i sent a message and it got 1 tick, 2 tick or received. Below i attached my screenshot code and output screenshot as well as an output file. If you can help please do because i dont know where i am going wrong.

Screenshot (40)
Screenshot (42)
sendChatResponse.txt

Post Send Message Crash

GET : /auth/checkclientstatus/61b0428a7d73d80bba8c248c
POST : /chatting/sendmessage
/sendmessage =>61b0428a7d73d80bba8c248c
/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221
throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
^

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'sendSeen')
at puppeteer_evaluation_script:6:31
at ExecutionContext._evaluateInternal (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext.evaluate (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.sendMessage (/var/www/html/WhatsappCode/node_modules/whatsapp-web.js/src/Client.js:560:28)

post image does not work properly.

post image does not work properly.
status post says success. however the image was not sent at the destination number.
curl -X POST http://142.11.xx.xx:5000/chat/sendimage/6282298749xxx -d "image=https://xxxxx.xxx/Content/img/version-12/icon/Icon-1.png&caption=test.jpeg"

output : {"status":"success","message":"MediaMessage successfully sent"}

I looked on the temp folder server. The picture has been downloaded. but sending picture messages to the client. no process occurred / did not send a picture. please help.

Dialogflow with Webhook

it is possible for your project to connect it to google dialogflow through a webhook. I would appreciate if you guide me

All Qr Code Gets Disconnected

GET : /auth/getqr/60f17e36fc6f05a3f23085bc
GET : /auth/closeClient/612894c27cc9999f794c0098
/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:217
this._callbacks.set(id, { resolve, reject, error: new Error(), method });
^

Error: Protocol error (Runtime.callFunctionOn): Target closed.
at /var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:217:63
at new Promise ()
at CDPSession.send (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:216:16)
at ExecutionContext._evaluateInternal (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:204:50)
at ExecutionContext.evaluateHandle (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:155:21)
at WaitTask.rerun (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:536:37)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)

[email protected] start
node api.js
Server Running Live on Port : 5000

npm ERR! code ELIFECYCLE

lastqr/6113last.qr generated
events.js:174
throw er; // Unhandled 'error' event
^

Error: socket hang up
at createHangUpError (_http_client.js:332:15)
at Socket.socketOnEnd (_http_client.js:435:23)
at Socket.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Socket.socketOnEnd (_http_client.js:435:9)
at Socket.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm
ERR! code ELIFECYCLE
npm
ERR!
errno 1
npm ERR!
[email protected] start: node api.js
npm ERR! Exit status 1
npm
ERR!
npm ERR!
Failed at the [email protected] start script.
npm ERR!
This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm
ERR! /root/.npm/_logs/2022-01-05T07_43_21_300Z-debug.log

QR code not working

I don't know if i'm doing something wrong, but after asking for the qr code, i get the response and i save it as html file. Then i open with a browser it correctly shows the qr code, but whatsapp gives a error asking to check if the qr code is from web.whatsapp.com (doesn't recognize it). What should i do? I'm using an italian whatsapp account.

Whats app Node APi Restarts on Send Message

GET : /auth/checkclientstatus/61c957865ede2b1affe8a3f9
POST : /chatting/sendmessage
/sendmessage =>61c957865ede2b1affe8a3f9
node:events:371
throw er; // Unhandled 'error' event
^

Error: socket hang up
at connResetException (node:internal/errors:691:14)
at Socket.socketOnEnd (node:_http_client:471:23)
at Socket.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ClientRequest instance at:
at Socket.socketOnEnd (node:_http_client:471:9)
at Socket.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}

[email protected] start

Not Connect

Server Running Live on Port : 5000
GET : /auth/getqr
(node:9068) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'default' of undefined
at puppeteer_evaluation_script:5:51
at ExecutionContext._evaluateInternal (C:\Users\Leo Teixeira\Desktop\apiwhats\whatsapp-node-api-master\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async ExecutionContext.evaluate (C:\Users\Leo Teixeira\Desktop\apiwhats\whatsapp-node-api-master\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:106:16)
at async Client.initialize (C:\Users\Leo Teixeira\Desktop\apiwhats\whatsapp-node-api-master\node_modules\whatsapp-web.js\src\Client.js:145:9)
(node:9068) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9068) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error After Scanning QR in updated WhatsApp

I have successfully implemented in more than 25 (Windows10 ) machines till now. For a couple of days (maybe 10 days), on random few NEW computers gives this message after scanning QR Code.
@pranavms13 Please help soon.

(node:10680) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
at puppeteer_evaluation_script:35:78
at ExecutionContext._evaluateInternal (C:\xyz\nm\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async ExecutionContext.evaluate (C:\xyz\nm\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
at async Client.initialize (C:\xyz\nm\node_modules\whatsapp-web.js\src\Client.js:161:9)
(Use node --trace-warnings ... to show where the warning was created)
(node:10680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10680) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Way to send url link

I'm having problems sending a link via message using this api

Example, http://google.com
It is sent as text and not as url link

Is there any way to send links or just text?

Verify authentication

is it possible to check if the device is authenticated and the session is valid? Today if I log out of the device, the API keeps returning that I am authenticated.

Update to latest whatsapp web base

Please someone fork it and update to latest whatsappweb js along with all the dependencies
This version is too old for to use, if anyone who have knowledge about backend may, improve this project it would be so great.

Memory optimisation issue

Hi , i am using multi-session for whatsapp--web js can you help me which code is best on the behalf of memory optimisation in multi-session like patch 3 or patch 4

After Scan Qr puppeteer showing error and server automatically froce quit

puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217
throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
^

Error: Evaluation failed: TypeError: Cannot read property 'serialize' of undefined
at puppeteer_evaluation_script:2:38
at ExecutionContext._evaluateInternal (C:\Users\Administrator\Downloads\Whatsapp_API\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext.evaluate (C:\Users\Administrator\Downloads\Whatsapp_API\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:106:16)
at async Client.initialize (C:\Users\Administrator\Downloads\Whatsapp_API\node_modules\whatsapp-web.js\src\Client.js:184:42)

any idea why it is happening.. or else I did the wrong method???

@pranavms13 please give a cmt on this

newTag

Cannot read properties of undefined (reading 'newTag')

ProtocolError: Protocol error (Runtime.callFunctionOn): Target closed

How to resolve this issue

GET : /auth/closeClient/623d7dbe003b3e0c0c76be59
ProtocolError: Protocol error (Runtime.callFunctionOn): Target closed.
at /var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230:24
at new Promise ()
at CDPSession.send (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:16)
at ExecutionContext._evaluateInternal (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:204:50)
at ExecutionContext.evaluateHandle (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:155:21)
at WaitTask.rerun (/var/www/html/WhatsappCode/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:551:37)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
originalMessage: ''
}

Error ready QRCODE

(node:5304) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'default' of undefined
at puppeteer_evaluation_script:5:51
at ExecutionContext._evaluateInternal (C:\API03\whatsapp-node-api-master\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async ExecutionContext.evaluate (C:\API03\whatsapp-node-api-master\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:106:16)
at async Client.initialize (C:\API03\whatsapp-node-api-master\node_modules\whatsapp-web.js\src\Client.js:145:9)
(Use node --trace-warnings ... to show where the warning was created)
(node:5304) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5304) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.