Groups Types#
- class pywa.types.groups.GroupDetails#
Represents the details of a WhatsApp group.
- Variables:
id (str) β The unique identifier of the group.
subject (str) β The subject for the group.
description (str | None) β The description of the group.
creation_timestamp (datetime.datetime) β The timestamp when the group was created.
suspended (bool) β Indicates if the group is suspended by WhatsApp.
total_participant_count (int) β The total number of participants in the group, excluding your business.
participants (list[GroupParticipant]) β The list of participants in the group, excluding your business.
join_approval_mode (GroupJoinApprovalMode) β Indicates if WhatsApp users who click the invitation link can join the group with or without being approved first.
- get_invite_link()#
Get the invite link for the group.
- Returns:
The invite link for the group.
- Return type:
- reset_invite_link()#
Reset the invite link for the group.
- Returns:
A new invite link for the group.
- Return type:
- get_join_requests(pagination=None)#
You can create groups that require join request approval. Once enabled, WhatsApp users who click the group invitation link can submit a request to join the group, or cancel a prior request:
- Parameters:
pagination (Pagination | None) β The pagination to use.
- Returns:
A Result iterable containing the join requests for the group.
- Return type:
- delete()#
Delete the group.
- Returns:
An operation representing the delete group request. You can use the returned request ID to track the status of the delete operation.
- Return type:
- remove_participants(participants)#
Remove participants from the group.
- remove_all_participants()#
Remove all participants from the group.
- Returns:
An operation representing the remove all participants request. You can use the returned request ID to track
- Return type:
- update(*, subject=None, description=None, profile_picture)#
Update group settings.
Read more at developers.facebook.com.
- Parameters:
subject (str | None) β Group subject, Maximum 128 characters.
description (str | None) β Group description. Maximum 2048 characters.
profile_picture (bytes | str | Path | BinaryIO | Iterator[bytes]) β The new group profile picture. Can be a bytes object, a file path, a file-like object, or an iterator that yields bytes.
- Returns:
An operation representing the update group settings request. You can use the returned request ID to track the status of the update operation.
- Return type:
- class pywa.types.groups.GroupParticipant#
Represents an participant in a WhatsApp group.
- Variables:
bsuid β
The WhatsApp userβs BSUID. See developers.facebook.com for more information.
wa_id β
The userβs phone number in international format (without the β+β sign). Will be unavailable if the user enables the username feature. See developers.facebook.com for more information.
username β The username of the user.
parent_bsuid β
The Parent business-scoped user ID. See developers.facebook.com for more information.
- remove()#
Remove the participant from the group.
- Return type:
- class pywa.types.groups.GroupInviteLink#
Represents an invite link for a WhatsApp group.
- reset()#
Reset the invite link.
- Returns:
A new invite link for the group.
- Return type:
- class pywa.types.groups.GroupJoinRequest#
Represents a join request for a WhatsApp group.
- Variables:
id (str) β The unique identifier of the join request.
user (GroupParticipant) β The user who submitted the join request.
creation_timestamp (datetime.datetime) β The timestamp when the join request was created.
- approve()#
Approve the join request.
- Return type:
- reject()#
Reject the join request.
- Return type:
- class pywa.types.groups.GroupJoinRequestsResult#
Bases:
Result[GroupJoinRequest]Represents a paginated result of group join requests for a WhatsApp group.
- approve_all(*, fetch_all=False, sleep=0.0)#
Approve all join requests.
- Parameters:
- Return type:
- reject_all(*, fetch_all=False, sleep=0.0)#
Reject all join requests.
- Parameters:
- Return type:
- class pywa.types.groups.GroupJoinApprovalMode#
Indicates if WhatsApp users who click the invitation link can join the group with or without being approved first.
- Variables:
AUTO_APPROVE β Indicates WhatsApp users can join the group without approval.
APPROVAL_REQUIRED β Indicates WhatsApp users must be approved via join request before they can access the group.
- class pywa.types.groups.GroupOperation#
Represents an operation performed on a WhatsApp group, such as creating a group or adding participants.
- Attributes:
request_id: The unique identifier for the group operation request. This can be used to track the status of the operation.