• Add one or more participants to a group

    The method return a object with the result of each participant as the key

    Parameters

    • groupId: string | Wid
    • participantsIds: string | Wid | (string | Wid)[]

    Returns Promise<{
        [key: `${number}@c.us`]: {
            code: number;
            invite_code: string | null;
            invite_code_exp: number | null;
            message: string;
            wid: string;
        };
    }>

    const result = await WPP.group.addParticipants('[group@g.us]', [number@c.us]);

    // Get participant result:
    console.log(result['123@c.us'].code);
    console.log(result['123@c.us'].invite_code);
    console.log(result['123@c.us'].invite_code_exp);
    console.log(result['123@c.us'].message);
    console.log(result['123@c.us'].wid);

    const memberResult = result['123@c.us']; // To a variable
    // or
    const memberResult = Object.values(result)[0]; // Always the first member result

    // How to send a custom invite link
    const link = 'https://chat.whatsapp.com/' + result['123@c.us'].invite_code;
    console.log(link);