Whatsapp-web js doesn't fire ready event
Asked Answered
A

2

7

Whatsapp-web js doesn’t fire ready event and other only fire Qr event. I alos scan and authenticate the whatsapp correctly. but not working ready event.

const { Client } = require('whatsapp-web.js');
var qrcode = require('qrcode-terminal');
const client = new Client();

client.on('qr', (qr) => {
qrcode.generate(qr, { small: true });
console.log('QR RECEIVED');
});

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

client.initialize();
Assuasive answered 25/8, 2023 at 3:23 Comment(0)
A
13

This was fixed my issue

npm r whatsapp-web.js

set this version in package.json "whatsapp-web.js": "https://github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7"

npm install

Assuasive answered 25/8, 2023 at 3:23 Comment(4)
also we can fix this issue with this version 1.22.2-alpha.0. Try npm i [email protected]Assuasive
Helped me. The official website doesn't tell it, such a huge mistake. wwebjs.devFlagelliform
1.22.2-alpha.0 does not contain the fix, at least not when I testedGorgon
im using 1.22.2-alpha.0 and still not receive client ready message. but when im trying use "whatsapp-web.js": "github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7" has been work. thankyouBema
N
7

I found in the official github the fix the issue, the solution is here: in summary you need to modify the file client.js in the node_modules/whatsapp-web.js/src/client.js

change the line 175 replace this:

 const INTRO_IMG_SELECTOR = 'div[role=\'textbox\']'; //'[data-icon=\'chat\']';

https://github.com/pedroslopez/whatsapp-web.js/issues/2473

Nadabas answered 7/9, 2023 at 23:7 Comment(2)
it works for me, version 1.22.1Nidianidicolous
yes this way is also working..Assuasive

© 2022 - 2025 — McMap. All rights reserved.