whatsapp-web.js icon indicating copy to clipboard operation
whatsapp-web.js copied to clipboard

Can't join group using code when "Request To Join" is needed

Open EdenGottlieb opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

When trying to join groups via invite code (public links in the form of https://chat.whatsapp.com/XXXXXX), when attempting to join groups that require admin approval (Request To Join appears when trying to join using a real device), an error is thrown.

Even though an error is thrown, a request to join is sent, and the device join the group once approved.

It would be great if we could somehow catch this error and portray to the user that the request to join was sent.

The error looks like this:

{ "name": "UnexpectedJoinGroupViaInviteResponse", "stack": "UnexpectedJoinGroupViaInviteResponse\n at new i (https://web.whatsapp.com/app.1b6002989bf96f16e110.js:43:32209)\n at new E (https://web.whatsapp.com/app.1b6002989bf96f16e110.js:55:481950)\n at t.WapParser._parser (https://web.whatsapp.com/main.7aa580748731d618b7aa.js:2:331197)\n at t.WapParser.parse (https://web.whatsapp.com/app.1b6002989bf96f16e110.js:5:187720)\n at t.WapParser.parseOrThrow (https://web.whatsapp.com/app.1b6002989bf96f16e110.js:5:187832)\n at t.parseIqResponse (https://web.whatsapp.com/app.1b6002989bf96f16e110.js:5:175107)\n at https://web.whatsapp.com/app.1b6002989bf96f16e110.js:5:153435", "gid": "<redacted>@g.us", "membershipApprovalMode": true }

Expected behavior

Expected to be able to send join request to group.

Steps to Reproduce the Bug or Issue

  1. Create a group that requires admin approval to join on another device
  2. Create a public link to join the group and send it to a phone that is connected whatsapp-web.js
  3. Attempt to join the group via the invite code using whatsapp-web.js "acceptInvite" function

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

OS: Mac Phone OS: Android whatsapp-web.js: 2.2.10 WhatsApp Web version: 2.2343.55 Node.js Version: 20.4.0

Additional context

No response

EdenGottlieb avatar Oct 10 '23 09:10 EdenGottlieb