pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.63k stars 3.73k forks source link

Error when sending a mesage #1738

Closed aiyemomi closed 2 years ago

aiyemomi commented 2 years ago

Is there an existing issue for this?

Describe the bug

Whenever I try to send a message I get the following error: Error: Evaluation failed: TypeError: chat.isEphemeralSettingOn is not a function at Object.window.WWebJS.sendMessage (puppeteer_evaluation_script:157:37) at puppeteer_evaluation_script:10:45 at ExecutionContext._evaluateInternal (C:\Users\RERE\Desktop\Web Development\Personal Projects\whatsapp automation\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (C:\Users\RERE\Desktop\Web Development\Personal Projects\whatsapp automation\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16) at async Client.sendMessage (C:\Users\RERE\Desktop\Web Development\Personal Projects\whatsapp automation\node_modules\whatsapp-web.js\src\Client.js:599:28)

Expected behavior

I expected a message to be sent from the terminal to a whatsapp account but instead I am getting an error message

Steps to Reproduce the Bug or Issue

  1. Set up the send message method
  2. pass id and message as arguments
  3. See error

Relevant Code

client.on('ready', () => { console.log('Client is ready!'); client.getChats().then((chats) => { const myGroup = chats.find((chat) => chat.name === 'WhatsApp automation test'); console.log(myGroup.id._serialized); client.sendMessage(myGroup.id._serialized, "Hello" ); }); });

Browser Type

Google Chrome

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Windows Phone OS: iOS whatsapp-web.js version 8.19.2 WhatsApp Web version: 2.2238.7 Node.js Version 16.17.1

Additional context

No response

jonylim commented 2 years ago

Try to delete the session folder (by default it should be .wwebjs_auth/session) and then re-link (scan QR) the device again

agustianra89 commented 2 years ago

Try to delete the session folder (by default it should be .wwebjs_auth/session) and then re-link (scan QR) the device again

Already do that, n' fine 1-2 hours, after that, error again...

wemersonrv commented 2 years ago

This error starts after Whatasapp Web updates to version 2.2240.5

aiyemomi commented 2 years ago

Try to delete the session folder (by default it should be .wwebjs_auth/session) and then re-link (scan QR) the device again

Whenever I delete the session file, on refresh it seems to appear back immediately into .wwebjs_auth/session directory

aiyemomi commented 2 years ago

This error starts after Whatasapp Web updates to version 2.2240.5

What do I do to resolve it?

mateusfmello commented 2 years ago

Hello, I was having the "chat.isEphemeralSettingOn is not a function" problem with several clients, I deleted all the files that the browser creates and told the clients to connect WhatsApp again (scan the QR Code), it worked perfectly again

crazytweeks commented 2 years ago

Try to delete the session folder (by default it should be .wwebjs_auth/session) and then re-link (scan QR) the device again

Whenever I delete the session file, on refresh it seems to appear back immediately into .wwebjs_auth/session directory

You have to stop server and delete those folder and restart your server. puppeteer process creates that folder. so make sure server running puppeteer is stopped.

Its better if u can also clear node_modules and re installing npm packages.

After clearing folder you will have to re login scanning QR code.

juanmanavarro commented 2 years ago

You have to stop server and delete those folder and restart your server. puppeteer process creates that folder. so make sure server running puppeteer is stopped.

Its better if u can also clear node_modules and re installing npm packages.

After clearing folder you will have to re login scanning QR code.

this is not working for me

fernandoVictor00 commented 2 years ago

Estou com o mesmo problema, vocês conseguiram resolver?

juanmanavarro commented 2 years ago

@fernandoVictor00 update to last version

edilsons commented 2 years ago

Precisa atualizar a versão do whatsapp-web.js... Em seu packages.json, localize-o e substitua por

"whatsapp-web.js": "^1.18.0",

depois disto, reinstale os pacotes...

PurpShell commented 2 years ago

This has been fixed after the release of the latest version (1.18.2)