wppconnect icon indicating copy to clipboard operation
wppconnect copied to clipboard

getMessages get undefined for certain chatId

Open momokang opened this issue 2 years ago • 2 comments

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

  1. Try to getMessages from a lot of chatId
  2. 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

momokang avatar Sep 28 '22 01:09 momokang

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.

momokang avatar Sep 28 '22 14:09 momokang

Update: it's not able who send button messages, if last message is button message, getMessage will return undefined.

momokang avatar Sep 28 '22 14:09 momokang

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?

icleitoncosta avatar Nov 18 '22 16:11 icleitoncosta

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, })

momokang avatar Nov 20 '22 15:11 momokang

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).

icleitoncosta avatar Jun 01 '23 22:06 icleitoncosta