#Can I Link a Participant who requests to Join with their LID (from groupMembershipRequests)

2 messages · Page 1 of 1 (latest)

timid kettle
#

Good morning friends, I am facing a challenge that makes me question if this library will work for me. The problem I'm trying to solve has the following workflow:

User messages my bot (I get their WhatsApp ID, e.g., 12347xxxxxxx@c.us).
Bot sends them a group invite link (the group requires admin approval before joining).
User requests to join the group (and I view the request via GroupChat.getGroupMembershipRequests() ).
I only want to approve requests from users who have completed a payment but .getGroupMembershipRequests() only gives me an @lid identifier

My problem is how I can successfully map a user's whatsapp ID (12347xxxxxxx@c.us) which I get before they request to join the group and the LID I get from the groupMembership request. Is this something that will be possible or should I consider a different approach? I have also read here issues with adding participants directly so I'm not sure that will be viable. I will appreciate any insights I get on this matter. Thank you in advance!

stone onyx
#

First, update your lib

npm i github:pedroslopez/whatsapp-web.js#main

and then use this

let user = await client.getContactLidAndPhone(phoneNumber@c.us);
console.log(user);
    
//OR
    
let user = await client.getContactLidAndPhone(xxxxxx@lid);
console.log(user);