Wa-automate-nodejs: Issue with client.onAck

Created on 12 Oct 2020  路  17Comments  路  Source: open-wa/wa-automate-nodejs

Describe the bug
If we call client.onAck for more than 50 messages, page is being unresponsive and stuck.

Steps to Reproduce
Steps to reproduce the behavior:

  1. call client.onAck((msg:any) => console.log(msg.id.toString(),msg.body,msg.ack)) for more than 50 messages at a time.

create() code
This is the code you use to create the client. e.g

const wa = require('@open-wa/wa-automate');

wa.create().then(client => start(client));

function start(client) {
  client.onAck((msg:any) => console.log(msg.id.toString(),msg.body,msg.ack));
}

Expected behavior
It shouldn't stop and return acknowledgement state for all the messages.

DEBUG INFO
This is the info printed to the console when you start your app. It should look like this

Debug Info {
  WA_VERSION: '2.2041.6',
  PAGE_UA: 'WhatsApp/2.2037.6 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36',
  WA_AUTOMATE_VERSION: '2.0.31',
  BROWSER_VERSION: 'HeadlessChrome/86.0.4240.75'
}

Screenshots
If applicable, add screenshots to help explain your problem. Use headless: false to get screenshots

Host (please complete the following information):

  • OS: Windows

Additional context
Previously it was returning acknowledge state even more than 500 messages.

Most helpful comment

@priteshpmehta @paulocorcino can you restart your session, try again and report if the patch worked please. thanks

All 17 comments

umm what do you mean by call client.onAck for more than 50 messages at a time ???

Really very sorry, If I am not able to explain you in proper way.

for example, If bot sent 50 messages to any number and after sometime if that number opens/read all the messages then client.onAck should return acknowledge state as 3 for all 50 messages but it stuck and doesn't continue with any function.

Thanks.

@priteshpmehta It may not necessarily return 3 for all 50 messages as 3 means that the message has been read (2 blue ticks). This seems like a duplicate of #915

Please update to the latest version, restart all of your sessions and try again.

@smashah I have restarted all the sessions and node process before creating the issue here. FYI, I am getting acknowledgement state as 3 (2 blue ticks) for first few chats and then it stops (Read receipts is ON).

@priteshpmehta I will need more context to recreate this issue. Are you using any other client methods or just onAck?

Yes, I am using other client methods too.

Here is the sample static code (In actual It is dynamic like text, fileURL, etc.):

const wa = require('@open-wa/wa-automate');

wa.create().then(client => start(client));

function start(client) {
  client.onMessage(async message => {
    if (message.from === '[email protected]') {
        for (let index = 0; index < 50; index++) {
            await client.sendText(message.from, '馃憢 Hello!');
            await client.sendFileFromUrl(message.from, 'https://i.giphy.com/media/oYtVHSxngR3lC/200w.mp4', 'video.mp4', 'xxxxx', null, null, true).then((serialized) => {
                console.log(`sendFileFromUrl has serialized ${serialized}\n`);
            }, (err) => {
                console.log(`sendFileFromUrl has error ${err}\n`);
            }); 
        }
    }
  });

  client.onAck((msg) => console.log(msg.id.toString(), msg.ack));
}

@priteshpmehta is it just me (my both phones) or are acknowledgments broken? I can see my own ticks, I can't see a recipient's ticks. :/

@priteshpmehta is it just me (my both phones) or are acknowledgments broken? I can see my own ticks, I can't see a recipient's ticks. :/

Hi @smashah ,

I guess client.onAck() is completely broken. I have upgraded @open-wa/wa-automate to 2.1.1 (latest version) and not able to see any acknowledgement.

image

@priteshpmehta as shown in my link above it looks like it's broken from WhatsApps side. I suggest commenting out your onAck code for now

Sure @smashah ..
Thanks

I'm with this same problem with onAck method.

onAck to me too not work more. I not saw because before I have been ignoring these messages, but now I need to use to controlling new process.

@priteshpmehta @paulocorcino can you restart your session, try again and report if the patch worked please. thanks

image

@smashah Wow! Thank you!

Hi @smashah ,

Just to remind you that the Initial issue in this ticket is still not resolved. Are you able to reproduce it at your end?

@priteshpmehta this issue is stale now can you make sure your open-wa is updated and if it's still causing problems then please open a new issue thanks

Was this page helpful?
0 / 5 - 0 ratings