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();
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();
Share
Improve this question
asked Aug 25, 2023 at 3:23
Tharuka DananjayaTharuka Dananjaya
4961 gold badge5 silver badges15 bronze badges
2 Answers
Reset to default 13This 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
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