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
14.49k stars 3.45k forks source link

Click here to get older messages from your phone #2937

Open momokang opened 2 months ago

momokang commented 2 months ago

Is there an existing issue for this?

Describe the bug

image

If from web WhatsApp, user can click the button on top of the chat and start loading the older messages from phone until like 3 months ago.

Do we have the option in this library to load older messages?

There is a similar issue which mark as completed https://github.com/pedroslopez/whatsapp-web.js/issues/2478 Chat.fetchMessages Is not working at all even I set limit to 999, the chat is only 10 messages only and I can't do anything on it.

Expected behavior

Able to load the messages by clicking the button

Steps to Reproduce the Bug or Issue

  1. Open a chat
  2. Scroll up
  3. Click older message

Relevant Code

waClient.getChatById(req.query.from) .then(async function (chat) { await chat.fetchMessages({ limit: 999, }) .then(async function (allMsg) { console.log(allMsg.length); // I only get 10 messages and there are a lot more message which is only 1 week ago is not showing }); });

Browser Type

Google Chrome

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Windows Phone OS: Android whatsapp-web.js version 1.23.1-alpha.3 WhatsApp Web version [run await client.getWWebVersion()]: Node.js Version 20.11

Additional context

No response

FaroukBel commented 2 weeks ago

This feature is so much needed, thanks to the devs in advance !