whatsapp-api-js - v6.4.0
    Preparing search index...

    Interface API

    interface API {
        approveGroupJoinRequests(
            groupID: string,
            ...requests: AtLeastOne<string>,
        ): Promise<ServerApproveGroupJoinRequestsResponse>;
        createGroup(
            phoneID: string,
            subject: string,
            description?: string,
            joinApprovalMode?: ClientGroupJoinApprovalMode,
        ): Promise<ServerGroupSuccessResponse>;
        deleteGroup(groupID: string): Promise<ServerGroupSuccessResponse>;
        rejectGroupJoinRequests(
            groupID: string,
            ...requests: AtLeastOne<string>,
        ): Promise<ServerRejectGroupJoinRequestsResponse>;
        removeGroupParticipants(
            groupID: string,
            ...users: AtLeastOne<ClientIndividualRecipientIdentifier>,
        ): Promise<ServerGroupSuccessResponse>;
        resetGroupInviteLink(
            groupID: string,
        ): Promise<ServerGroupInviteLinkResponse>;
        retrieveGroup(
            groupID: string,
            fields?: ServerGroupField[],
        ): Promise<ServerRetrieveGroupResponse>;
        retrieveGroupInviteLink(
            groupID: string,
        ): Promise<ServerGroupInviteLinkResponse>;
        retrieveGroupJoinRequests(
            groupID: string,
        ): Promise<ServerRetrieveGroupJoinRequestsResponse>;
        retrieveGroups(
            phoneID: string,
            limit?: number,
            after?: string,
            before?: string,
        ): Promise<ServerRetrieveGroupsResponse>;
        updateGroup(
            groupID: string,
            settings: { description?: string; subject?: string },
        ): Promise<ServerGroupSuccessResponse>;
        updateGroupPicture(
            groupID: string,
            form: unknown,
            check?: boolean,
        ): Promise<ServerGroupSuccessResponse>;
    }

    Implemented by

    Index
    • Beta

      Create a new group

      The group isn't ready when this resolves. Its id and invite link arrive later on the group_lifecycle_update webhook.

      Parameters

      • phoneID: string

        The bot's phone ID

      • subject: string

        The group's name (128 characters max)

      • Optionaldescription: string

        The group's description (2048 characters max)

      • OptionaljoinApprovalMode: ClientGroupJoinApprovalMode

        If users need to be approved before joining, defaults to "auto_approve"

      Returns Promise<ServerGroupSuccessResponse>

      The server response

      Only available for Official Business Accounts

    • Beta

      Get the active groups of the bot

      Parameters

      • phoneID: string

        The bot's phone ID

      • Optionallimit: number

        How many groups to get, between 1 and 1024 (Meta defaults to 25)

      • Optionalafter: string

        Cursor to get the next page

      • Optionalbefore: string

        Cursor to get the previous page

      Returns Promise<ServerRetrieveGroupsResponse>

      The server response

    • Beta

      Update the subject and/or description of a group

      Parameters

      • groupID: string

        The group's ID

      • settings: { description?: string; subject?: string }

        The new subject (128 characters max) and/or description (2048 characters max)

      Returns Promise<ServerGroupSuccessResponse>

      The server response

      updateGroupPicture to change the group's picture

    • Beta

      Update the picture of a group

      Parameters

      • groupID: string

        The group's ID

      • form: unknown

        The picture's FormData, with the image in the "file" field

      • Optionalcheck: boolean

        If the FormData should be checked before uploading

      Returns Promise<ServerGroupSuccessResponse>

      The server response

      • The image must be a square JPEG of at least 192x192 pixels and up to 5MB
      • The image scale and resolution isn't validated by the library

      If check is set to true and form is not a FormData

      If check is set to true and the form file is not a JPEG

      If check is set to true and the form file is too big