-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat.fetchMessages with limit: Infinity return only one message #2297
Comments
You have to wait a bit while it fetches messages before calling this method, so after client connects, set a TimeOut or something to delay a bit while all messages are loading, then try get the messages, I hope this helps : ) |
Thanks, but if I run this
I get all messages (or 1024 max). |
interesting, I am yet to experience that, I believe someone with more experience in that |
"Infinity" should be a string. Works fine. const messages = await chat.fetchMessages({limit: "Infinity"}); |
i've stumbled upon this error too does anyone know if there's a pr for it already? i volunteer to fix this. |
I just spent the last 4 hours debugging this behavior. What I can resume from my findings: There are 3 Layers of data:
Looking into what actually happens is as follows:
The thing is, this method is not whell documented, but I have figured out how to call it and force it to load more messages, and even, be able to change "how many messages" to fetch from device at once. The steps are (assuming
|
@ivanseidel, I didn't get your suggestion. Kind of hard to understand what to do to solve it, despite it is easy to understand the layers of data and how WA works behind the scenes. |
Is there an existing issue for this?
Describe the bug
I'm trying to fetch all messages from all chats. As described in the documentation, I need to pass the Infinity to the limit property of the searchOptions https://docs.wwebjs.dev/Chat.html#fetchMessages. But I received only the latest message from the chat instead of all messages.
Expected behavior
As described in the documentation the method should return all messages from the chat.
Steps to Reproduce the Bug or Issue
Relevant Code
Browser Type
Chromium
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: