• Create a new group

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

    Parameters

    • groupName: string
    • participantsIds: string | Wid | (string | Wid)[]
    • parentGroup: string | Wid

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

    const result = await WPP.group.create('Test Group', ['number@c.us']);

    console.log(result.gid.toString()); // Get the group ID

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

    const memberResult = result['number@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['number@c.us'].invite_code;
    console.log(link);

    // Create a Subgroup for a community
    const result = await WPP.group.create('Test Group', ['number@c.us'], 'communit@g.us');