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.53k stars 3.7k forks source link

Client's first message doesn´t reach #1429

Closed jesusroja96 closed 11 months ago

jesusroja96 commented 2 years ago

Is there an existing issue for this?

Describe the bug

The first message of the client doesn't reach to the message event, you have to send it again for the event to start properly.

Expected behavior

The server should response at the first message sent.

Steps to Reproduce the Bug or Issue

  1. Create the bot.
  2. Send message to the bot.
  3. Message doesn't reach.
  4. The server doesn´t response.

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Ubunty 20.10 Node.js 12.18.2 whatsapp-web.js ^1.16.6

Additional context

No response

DES7RIKER commented 2 years ago

I had the same error, it seems to me that it is due to the handshake that occurs when a new chat is started and the security certificates are exchanged with the host device (the mobile) the extra WhatsApp sessions have to wait, the message arrives as : wait for the message, the problem is that since I couldn't access it from the api and when the body of the message arrives it doesn't generate a new notification, it goes unnoticed. For me the first message is very important so I have returned to the legacy option. If anyone knows a workaround or how to solve it I would like to know,

rishhavv commented 2 years ago

@DES7RIKER can you tell exactly how you're worked around this issue. It would help a lot.

trustedadvisor2020 commented 2 years ago

+1

DES7RIKER commented 2 years ago

@DES7RIKER can you tell exactly how you're worked around this issue. It would help a lot.

I went back to using the old version that is not multi-device. using version 2.22.2 of whatsapp and using this login. but it is not ideal and it is not so recommended but it worked for me, as something temporary https://wwebjs.dev/guide/authentication.html#legacysessionauth-strategy

mkraulich commented 2 years ago

+1

sky-ermesombarros commented 2 years ago

+1

shmuliko commented 2 years ago

try catch message type "e2e_notification"

jesusroja96 commented 2 years ago

try catch message type "e2e_notification"

where do you mean?

jesusroja96 commented 2 years ago

@DES7RIKER can you tell exactly how you're worked around this issue. It would help a lot.

I went back to using the old version that is not multi-device. using version 2.22.2 of whatsapp and using this login. but it is not ideal and it is not so recommended but it worked for me, as something temporary https://wwebjs.dev/guide/authentication.html#legacysessionauth-strategy

But eventually that version will expire, right

kikemarto commented 2 years ago

+1