Closed dardarsh closed 10 months ago
I want to fetch last 2 messages of a particular chat . I have the below code
client.getChats() .then((chat)=>{ console.log(chat.fetchMessages({limit: 2})).then((e)=>{console.log(e)}) })
upon running this code i am getting the following error
(node:35964) UnhandledPromiseRejectionWarning: TypeError: chat.fetchMessages is not a function at evalmachine.<anonymous>:3:22
I want last 2 messages of that chat to appear
No response
Chromium
Standard
Yes, I am using Multi Device
Windows Android latest version whatsapp web js
client.getChats() returns an array of chats, not just a single object You need to forEach first to get the object of each chat
Is there an existing issue for this?
Describe the bug
I want to fetch last 2 messages of a particular chat . I have the below code
upon running this code i am getting the following error
Expected behavior
I want last 2 messages of that chat to appear
Steps to Reproduce the Bug or Issue
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
Windows Android latest version whatsapp web js
Additional context
No response