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.18k stars 3.62k forks source link

Missing add message events for initially synced messages #3219

Open gucki opened 2 months ago

gucki commented 2 months ago

Is there an existing issue for this?

Describe the bug

When opening whatsapp web the client seems to do a bulk sync of messages since the last active session. During this sync the ui isn't showing the chats but some loading indicator with some text like "Please wait while your messages are being synced...". It seems that whatsapp-web.js is "missing" all these synced messages because no "add" event on the "Store" is fired for each message. Is this a known issue? How to work around it? I need to process all messages (even the whatsapp-web.js client was down for a few hours) and must not miss any.

Expected behavior

An add event is emitted for all new messages, including those retrieved during a "bulk" sync (the sync which occurs after the web client wasn't online for some time and many messages arrived meanwhile).

Steps to Reproduce the Bug or Issue

Close the whatsapp-web.js client. Wait some time (a few hours?) meanwhile many messages are received by the device (without having a whatsapp web session open). Start the whatsapp-web.js client and see how whatsapp is performing a "bulk" sync. No add event is emitted for many (all?) bulk synced messages.

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

latest versions

Additional context

No response