open-wa/wa-automate-nodejs
Do you want to work on this issue?
You can request for a bounty in order to promote it!
Getting the following error on adding participants: "ADD_BLOCKED: TypeError: Cannot read properties of undefined (reading 'toJid')", #3124
antipr000 posted onGitHub
Are you using the latest version of the library?
- I have checked and am using the latest version of the library.
What type of session are you experiencing this issue on?
Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag
What type of host account are you experiencing this issue on?
Personal account (normal)
Mode
My own code
Current Behavior
First I create a group using the following code
const response = await this.whatsappClient[session.id].createGroup(
groupName,
participants,
);
Note: I need to maintain multiple sessions
I get the following response
{
"wid": {
"server": "g.us",
"user": "<g_no>",
"_serialized": "<g_no>@g.us"
},
"subject": "Test group 3",
"creator": {
"server": "c.us",
"user": "<ph_no>",
"_serialized": "<ph_no>@c.us"
},
"ts": 1684410745,
"participants": [
{
"wid": {
"server": "c.us",
"user": "<ph_no>",
"_serialized": "<ph_no>@c.us"
},
"error": null,
"invite_code": null,
"invite_code_exp": null,
"type": "superadmin"
},
{
"wid": {
"server": "c.us",
"user": "<ph_no_2>",
"_serialized": "<ph_no_2>@c.us"
},
"error": null,
"invite_code": null,
"invite_code_exp": null,
"type": "participant"
}
]
}
Then I am using wid._serialized
as the groupID and calling the addParticipant
await this.whatsappClient[sessionID].addParticipant(
groupID as GroupChatId,
contactId,
);
Getting the following error:
{
"statusCode": 400,
"message": "ADD_BLOCKED: TypeError: Cannot read properties of undefined (reading 'toJid')",
"error": "Bad Request"
}
Expected Behavior
The participant should get added
Steps To Reproduce
- Create a new session and scan QR code
- Create a new group with the session
- Try adding a participant to the group
create() code OR full CLI command + CONFIG
this.whatsappClient[session.id] = await create({
sessionId: session.id,
multiDevice: true, //required to enable multiDevice support
authTimeout: 60, //wait only 60 seconds to get a connection with the host account device
blockCrashLogs: true,
disableSpins: true,
headless: true,
logConsole: false,
qrLogSkip: true,
popup: true,
qrTimeout: 0, //0 means it will wait forever for you to scan the qr code
chromiumArgs: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-sandbox',
],
useChrome: true,
});
});
DEBUG INFO
Debug info: {
"WA_VERSION": "2.2320.10",
"PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
"WA_AUTOMATE_VERSION": "4.66.0",
"BROWSER_VERSION": "HeadlessChrome/113.0.5672.126",
"OS": "macOS Monterey",
"START_TS": 1684411032018,
"RAM_INFO": "Total: 17.18 GB | Free: 0.11 GB",
"PPTR_VERSION": "19.11.1"
}
Environment
- OS: macOS Monterey V 12.2.1
- Node: v16.19.0
- yarn: 1.22.19
Screenshots/Logs
No response
Anything else?
No response