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
15.53k stars 3.7k forks source link

Unknown error (internally IQErrorRateOverlimit) while calling group.addParticipants() (#webpack-exodus) #3220

Closed codefield1 closed 1 month ago

codefield1 commented 3 months ago

Is there an existing issue for this?

Describe the bug

While adding multiple members to a group using addParticipants() with the default sleep value ([250, 500]) and autoSendInviteV4 on/off (doesn't matter), I get an error code 400 (unknown error) after four successfully added members for all others. Waiting some time seems to help, but after four added members the same error occurs again. Internally it seems to be a rate limit by WhatsApp.

After some testing and increasing the sleep time between the added members up to 10 seconds, it seems to work for more than 100 members, but eventually the limit error will return.

Issue #2344 added the sleep option to prevent Whatsapp from banning users, maybe the limit is new and didn't exist back then. There was no limit issue reported.

Expected behavior

I expect to be able to add multiple members using addParticipants() with the default sleep values.

And that the rate-limit error should be processed internally and returned to the addParticipants() caller as error 429.

Steps to Reproduce the Bug or Issue

  1. Call addParticipants() with multiple ids or multiple calls with one id using the default sleep value.

Relevant Code

I found the error being thrown in this code block in /src/util/Injected/Utils.js in window.WWebJS.getAddParticipantsRpcResult():

try { rpcResult = await window.Store.GroupParticipants.sendAddParticipantsRPC({ participantArgs, iqTo }); resultArgs = isOldImpl ? rpcResult.value.addParticipant[0].addParticipantsParticipantMixins : rpcResult.value.addParticipant[0] .addParticipantsParticipantAddedOrNonRegisteredWaUserParticipantErrorLidResponseMixinGroup .value .addParticipantsParticipantMixins; } catch (err) { data.code = 400; return data; }

The call to window.Store.GroupParticipants.sendAddParticipantsRPC() returns the following error which leads to an exception on the next lines, which is catched and returned as 400 (unknown) and not processed as a "AddParticipantsResponseClientError" in the lines after:

{ "name": "AddParticipantsResponseClientError", "value": { "type": "error", "errorAddParticipantsClientErrors": { "name": "IQErrorRateOverlimit", "value": { "text": "rate-overlimit", "code": 429 } } } }

Browser Type

Chromium

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

No, I am not using Multi Device

Environment

OS: Debian 12 Phone OS: iOS whatsapp-web.js version: pedroslopez/whatsapp-web.js#webpack-exodus WhatsApp Web version: 2.3000.1015038576 - 2.3000.1015044473 Node.js Version: 20.15.0

Additional context

No response

alechkos commented 1 month ago

Call addParticipants with higher sleep value