wppconnect
wppconnect copied to clipboard
getMessages get undefined for certain chatId
Description
getMessages get undefined for certain chatId Not all chatId will have this issue, but if some of it have, then this app can't be known as "stable"
Environment
- WPPConnect version(s): 1.16.1
- WA-JS version(s): X.Y.Z
- Browser: Chrome 105
- OS: Windows 10
- Node version: Node 16.7.0
- WhatsApp version: X.YYYY.ZZ
- MultiDevice (BETA): yes
Steps to Reproduce
- Try to getMessages from a lot of chatId
- You will find one or more chatId have this issue
Log Output
Your Code
waClient.getMessages(chatId)
.then(function (allMsg) {
if (allMsg == undefined) {
return;
}
return allMsg;
});
Additional context / Screenshot
undefined
Ok, I know why it will show error for certain chatId, it's because you send button messages to user and they didnt respond it, I know the reason but I have no idea how to fix it.
Update: it's not able who send button messages, if last message is button message, getMessage will return undefined.
Hello, I tried to reproduce this one to try to correct it, but here it is normally returning the messages. Could you test on the latest version and see if it's still connected?
Hello, I tried to reproduce this one to try to correct it, but here it is normally returning the messages. Could you test on the latest version and see if it's still connected?
Hi, I tried with latest 1.19.1, still the same, it will only be error if last message is button messages wpp.sendText( customerPhone, jsonMessage["message"], { useTemplateButtons: false, // False for legacy buttons: jsonButtons, })
Hello, I tried to reproduce this one to try to correct it, but here it is normally returning the messages. Could you test on the latest version and see if it's still connected?
Hi, I tried with latest 1.19.1, still the same, it will only be error if last message is button messages wpp.sendText( customerPhone, jsonMessage["message"], { useTemplateButtons: false, // False for legacy buttons: jsonButtons, })
This was happening because we were using an alternative button template. Since it is no longer possible to send buttons, the error is not occurring anymore (when you receive it from the official API).