whatsapp-web.js
whatsapp-web.js copied to clipboard
chat.addParticipants Always report errors
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
chat.addParticipants Always report errors
addParticipants Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'id')
at https://web.whatsapp.com/main.6ce9d02486f0affed52c.js:2:200232
at Array.some (
Expected behavior
.
Steps to Reproduce the Bug or Issue
.
Relevant Code
let chat_id = '1203630302*****@g.us'; let participants = [ "55949***@c.us", "55649***@c.us" ]; client.getChatById(chat_id).then(function (chat) { if (!chat) {
return;
}
chat.addParticipants(participants).then(function (res) {
if (!res) {
return;
}
console.log(res);
}).catch(function (err) {
});
}).catch(function (err) {
});
Browser Type
Chromium
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
default
Additional context
No response
You should problably get all contacts from the chip, and then filter by the id.
did you check:
- If the person you are trying to add is a contact of yours?
- Maybe set
let participants = ["55949***"]
without the "@g.us"?
Any news about this?