Closed luanmnz closed 4 years ago
@luanmnz
const res = await globalClient.addParticipant('xxxxx-xxxx@g.us', 'xxxxx-xxxx@c.us');
Why is there a -
in the second parameter? -
is only used in a group id. It looks like you are removing a group from a group.
@luanmnz is the account you're trying to remove a contact?
@luanmnz
const res = await globalClient.addParticipant('xxxxx-xxxx@g.us', 'xxxxx-xxxx@c.us');
Why is there a
-
in the second parameter?-
is only used in a group id. It looks like you are removing a group from a group.
It's only an example. I'm trying to add an participant to a group. I'm giving the group id in the first param, and the contact id in the second param. Ignore the -
in the second param
@luanmnz is the participant you're trying to add a contact or some random number?
@luanmnz is the participant you're trying to add a contact or some random number?
is a number that has whatsapp, but is not in my contacts
@luanmnz you can't add random people to groups. They have to be in your contacts
Try to send them an invite link instead
@luanmnz you can't add random people to groups. They have to be in your contacts
Try to send them an invite link instead
I tried to add this number to my contacts, it appeared on the whatsapp list, but still it was not possible to add it to the group
@luanmnz try this:
If that works then the issue is because the person you're trying to add is not a contact.
You can force the session to sync contacts (after you do it from the phone) using: https://open-wa.github.io/wa-automate-nodejs/classes/client.html#synccontacts
Again, the best thing to do is to add them after they have started a chat with you or generate the invite link and send it to them.
When i call the method addParticipant, i have the above error in puppeteer:
Evaluation failed: TypeError: Cannot read property 'id' of undefined\n at https://web.whatsapp.com/lazy_loaded_high_priority_components~lazy_loaded_low_priority_components.b1c2491b1125907ddb05.js:2:48250\n at Array.some (<anonymous>)\n at e (https://web.whatsapp.com/lazy_loaded_high_priority_components~lazy_loaded_low_priority_components.b1c2491b1125907ddb05.js:2:48217)\n at Object.t.addParticipants (https://web.whatsapp.com/lazy_loaded_high_priority_components~lazy_loaded_low_priority_components.b1c2491b1125907ddb05.js:2:49026)\n at Object.window.WAPI.addParticipant (/Users/luanmenezes/Projetos/api-whatsapp/node_modules/@open-wa/wa-automate/dist/lib/wapi.js:1964:37)\n at __puppeteer_evaluation_script__:3:41
my code:
create code: