@wppconnect-team/wppconnect - v1.36.4
    Preparing search index...

    Function addParticipants

    • Add one or more participants to a group

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

      Parameters

      Returns Promise<
          {
              [key: `${number}@c.us`]: {
                  code: number;
                  invite_code: string;
                  invite_code_exp: number;
                  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);