Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
feat(sdk): expose the group membership-request routes in all five clients
Yudhi Armyndharisf5d263e368ca
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 294a3d470..77f26bbf6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- `DELETE /sessions/:sessionId/profile/picture` removes the account profile picture on both engines; removing one that is already absent is a no-op answering `200`, so the call is safe to repeat.- `docs-29-counts.spec.ts` binds every count-shaped claim in `docs/29` to the capability matrix, so a figure restated in the intro, the architecture prose, a mermaid node or a section heading cannot drift from the source it restates.- The JavaScript, Python, PHP, Go and Java SDKs expose `PUT /sessions/:id/presence`, which sets the account's own global presence. The gateway has published the route since v0.15.0 with no client counterpart, so a typed client had to fall back to a raw request. It is the account's presence, not a chat's — the per-chat typing and recording states are unchanged on the chats resource.+- The JavaScript, Python, PHP, Go and Java SDKs expose the three group membership-request routes — list, approve and reject. The gateway has published them since v0.15.0 with no client counterpart. Omitting the participant list acts on every pending request, and an approval that WhatsApp refuses for some requesters still answers `200`, reporting the outcome per participant in `results`.### Fixeddiff --git a/docs/18-sdk-design.md b/docs/18-sdk-design.mdindex 06f3f7464..faedf77ad 100644--- a/docs/18-sdk-design.md+++ b/docs/18-sdk-design.md@@ -26,24 +26,24 @@ OpenWA ships five official, hand-written client libraries for the REST API. TheyAll five SDKs expose the same fluent surface:-| Resource | Methods |-| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| `sessions` | list, get, getConfig, updateConfig, create, delete, start, stop, logout, forceKill, getQrCode, requestPairingCode, setOnlinePresence, stats |-| `messages` | list, sendText, sendImage/Video/Audio/Document/Sticker, sendLocation, sendContact, sendTemplate, sendPoll, reply, forward, react, delete, editMessage, history, reactions, media, pin, unpin, star, votePoll, sendBulk, batchStatus, cancelBatch |-| `contacts` | list, get, check, profilePicture, profilePictures, phone, upsert, delete, block, unblock |-| `groups` | list, get, create, joinInfo, joinGroup, add/remove/promote/demoteParticipants, setSubject, setDescription, getGroupSettings, updateGroupSettings, leave, getPicture, setPicture, deletePicture, inviteCode, revokeInviteCode |-| `webhooks` | list, listAll, deliveryFailures, get, create, update, delete, test |-| `chats` | list, subscribePresence, getPresence, markRead, markUnread, archive, clearMessages, delete, sendState |-| `labels` | list, get, chats, upsert, delete, forChat, addToChat, removeFromChat _(WhatsApp Business)_ |-| `channels` | list, get, messages, create, delete, mute, subscribe, unsubscribe _(Newsletters)_ |-| `catalog` | info, products, product, sendProduct, sendCatalog _(WhatsApp Business)_ |-| `status` | list, fromContact, media, sendText, sendImage, sendVideo, sendVoice, delete _(Stories)_ |-| `search` | search |-| `templates` | list, get, create, update, delete |-| `profile` | setProfileName, setProfileStatus, setProfilePicture |-| `calls` | rejectCall |-| `media` | conversionStatus, convertVoice, convertVideo _(OPERATOR)_ |-| `health` | check, live, ready |+| Resource | Methods |+| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `sessions` | list, get, getConfig, updateConfig, create, delete, start, stop, logout, forceKill, getQrCode, requestPairingCode, setOnlinePresence, stats |+| `messages` | list, sendText, sendImage/Video/Audio/Document/Sticker, sendLocation, sendContact, sendTemplate, sendPoll, reply, forward, react, delete, editMessage, history, reactions, media, pin, unpin, star, votePoll, sendBulk, batchStatus, cancelBatch |+| `contacts` | list, get, check, profilePicture, profilePictures, phone, upsert, delete, block, unblock |+| `groups` | list, get, create, joinInfo, joinGroup, add/remove/promote/demoteParticipants, setSubject, setDescription, getGroupSettings, updateGroupSettings, leave, getPicture, setPicture, deletePicture, inviteCode, revokeInviteCode, getMembershipRequests, approveMembershipRequests, rejectMembershipRequests |+| `webhooks` | list, listAll, deliveryFailures, get, create, update, delete, test |+| `chats` | list, subscribePresence, getPresence, markRead, markUnread, archive, clearMessages, delete, sendState |+| `labels` | list, get, chats, upsert, delete, forChat, addToChat, removeFromChat _(WhatsApp Business)_ |+| `channels` | list, get, messages, create, delete, mute, subscribe, unsubscribe _(Newsletters)_ |+| `catalog` | info, products, product, sendProduct, sendCatalog _(WhatsApp Business)_ |+| `status` | list, fromContact, media, sendText, sendImage, sendVideo, sendVoice, delete _(Stories)_ |+| `search` | search |+| `templates` | list, get, create, update, delete |+| `profile` | setProfileName, setProfileStatus, setProfilePicture |+| `calls` | rejectCall |+| `media` | conversionStatus, convertVoice, convertVideo _(OPERATOR)_ |+| `health` | check, live, ready |> The SDKs cover the user-facing resources above and stop there. The administrative and operational surfaces are deliberately left out — `auth/api-keys`, `audit`, `settings`, `stats`, `automation`, `infra`, `plugins` and the `integration` management routes are predominantly `ADMIN`-gated; `metrics` is a `@Public()` Prometheus scrape gated by `METRICS_TOKEN` rather than by role; `mcp` is a Streamable-HTTP transport mounted straight onto the Express adapter; and `ingress` is the `@Public()` receiver that integration providers post into. `docker` has no HTTP surface at all — it is an internal service module. Methods that require an `OPERATOR`-level key are annotated **OPERATOR** in the per-language tables below.@@ -191,27 +191,30 @@ Media bodies share the `SendMediaRequest` shape: `{ chatId, url? | base64?, mime#### `groups`-| Method | Signature | Description |-| --------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |-| `list` | `list(sessionId, query?)` | List all groups for the session. |-| `get` | `get(sessionId, groupId)` | Get detailed group info including participants. |-| `create` | `create(sessionId, body)` | Create a new group. **OPERATOR** |-| `joinInfo` | `joinInfo(sessionId, code)` | Preview a group from its invite code WITHOUT joining. Read-only, so it is safe to call on a code from an untrusted source. |-| `joinGroup` | `joinGroup(sessionId, body)` | Join a group via its invite code. **OPERATOR** |-| `addParticipants` | `addParticipants(sessionId, groupId, participants)` | Add participants (`string[]`) to a group. **OPERATOR** |-| `removeParticipants` | `removeParticipants(sessionId, groupId, participants)` | Remove participants from a group. **OPERATOR** |-| `promoteParticipants` | `promoteParticipants(sessionId, groupId, participants)` | Promote participants to group admin. **OPERATOR** |-| `demoteParticipants` | `demoteParticipants(sessionId, groupId, participants)` | Demote participants from group admin. **OPERATOR** |-| `setSubject` | `setSubject(sessionId, groupId, subject)` | Update the group subject (name). **OPERATOR** |-| `setDescription` | `setDescription(sessionId, groupId, description)` | Update the group description (empty clears it). **OPERATOR** |-| `getGroupSettings` | `getGroupSettings(sessionId, groupId)` | Get the group settings (announce / locked / ephemeral timer). |-| `updateGroupSettings` | `updateGroupSettings(sessionId, groupId, body)` | Update the group settings (at least one field required). **OPERATOR** |-| `leave` | `leave(sessionId, groupId)` | Leave a group. **OPERATOR** |-| `getPicture` | `getPicture(sessionId, groupId)` | The group's picture URL, or `null` when it has none. |-| `setPicture` | `setPicture(sessionId, groupId, body)` | Set the group's picture. **OPERATOR** |-| `deletePicture` | `deletePicture(sessionId, groupId)` | Remove the group's picture. **OPERATOR** |-| `inviteCode` | `inviteCode(sessionId, groupId)` | Get the group invite code and link. |-| `revokeInviteCode` | `revokeInviteCode(sessionId, groupId)` | Revoke the current invite code and generate a new one. **OPERATOR** |+| Method | Signature | Description |+| --------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |+| `list` | `list(sessionId, query?)` | List all groups for the session. |+| `get` | `get(sessionId, groupId)` | Get detailed group info including participants. |+| `create` | `create(sessionId, body)` | Create a new group. **OPERATOR** |+| `joinInfo` | `joinInfo(sessionId, code)` | Preview a group from its invite code WITHOUT joining. Read-only, so it is safe to call on a code from an untrusted source. |+| `joinGroup` | `joinGroup(sessionId, body)` | Join a group via its invite code. **OPERATOR** |+| `addParticipants` | `addParticipants(sessionId, groupId, participants)` | Add participants (`string[]`) to a group. **OPERATOR** |+| `removeParticipants` | `removeParticipants(sessionId, groupId, participants)` | Remove participants from a group. **OPERATOR** |+| `promoteParticipants` | `promoteParticipants(sessionId, groupId, participants)` | Promote participants to group admin. **OPERATOR** |+| `demoteParticipants` | `demoteParticipants(sessionId, groupId, participants)` | Demote participants from group admin. **OPERATOR** |+| `setSubject` | `setSubject(sessionId, groupId, subject)` | Update the group subject (name). **OPERATOR** |+| `setDescription` | `setDescription(sessionId, groupId, description)` | Update the group description (empty clears it). **OPERATOR** |+| `getGroupSettings` | `getGroupSettings(sessionId, groupId)` | Get the group settings (announce / locked / ephemeral timer). |+| `updateGroupSettings` | `updateGroupSettings(sessionId, groupId, body)` | Update the group settings (at least one field required). **OPERATOR** |+| `leave` | `leave(sessionId, groupId)` | Leave a group. **OPERATOR** |+| `getPicture` | `getPicture(sessionId, groupId)` | The group's picture URL, or `null` when it has none. |+| `setPicture` | `setPicture(sessionId, groupId, body)` | Set the group's picture. **OPERATOR** |+| `deletePicture` | `deletePicture(sessionId, groupId)` | Remove the group's picture. **OPERATOR** |+| `inviteCode` | `inviteCode(sessionId, groupId)` | Get the group invite code and link. |+| `revokeInviteCode` | `revokeInviteCode(sessionId, groupId)` | Revoke the current invite code and generate a new one. **OPERATOR** |+| `getMembershipRequests` | `getMembershipRequests(sessionId, groupId)` | List a group's pending join requests. Requires group admin. **OPERATOR** |+| `approveMembershipRequests` | `approveMembershipRequests(sessionId, groupId, participants?)` | Approve pending join requests; omit the list to approve all. **OPERATOR** |+| `rejectMembershipRequests` | `rejectMembershipRequests(sessionId, groupId, participants?)` | Reject pending join requests; omit the list to reject all. **OPERATOR** |#### `chats`@@ -551,27 +554,30 @@ Resources are accessed as properties on the client (e.g. `client.messages`). All#### `client.groups`-| Method | Signature | Description |-| ----------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |-| `list` | `list(session_id, query=None) -> list[GroupSummary]` | List groups (`query`: `limit`, `offset`). |-| `get` | `get(session_id, group_id) -> GroupInfo` | Get group details. |-| `create` | `create(session_id, body) -> GroupInfo` | Create a group. **OPERATOR** |-| `join_info` | `join_info(session_id, code) -> GroupJoinInfo` | Preview a group from its invite code WITHOUT joining. Read-only, so it is safe to call on a code from an untrusted source. |-| `join_group` | `join_group(session_id, body) -> JoinGroupResponse` | Join a group via its invite code. **OPERATOR** |-| `add_participants` | `add_participants(session_id, group_id, participants) -> SuccessResult` | Add participants (`list[str]`). **OPERATOR** |-| `remove_participants` | `remove_participants(session_id, group_id, participants) -> SuccessResult` | Remove participants. **OPERATOR** |-| `promote_participants` | `promote_participants(session_id, group_id, participants) -> SuccessResult` | Promote to admin. **OPERATOR** |-| `demote_participants` | `demote_participants(session_id, group_id, participants) -> SuccessResult` | Demote from admin. **OPERATOR** |-| `set_subject` | `set_subject(session_id, group_id, subject) -> SuccessResult` | Set group subject. **OPERATOR** |-| `set_description` | `set_description(session_id, group_id, description) -> SuccessResult` | Set group description. **OPERATOR** |-| `get_group_settings` | `get_group_settings(session_id, group_id) -> GroupSettings` | Get the group settings (announce / locked / ephemeral timer). |-| `update_group_settings` | `update_group_settings(session_id, group_id, body) -> SuccessResult` | Update the group settings (at least one field required). **OPERATOR** |-| `leave` | `leave(session_id, group_id) -> SuccessResult` | Leave the group. **OPERATOR** |-| `get_picture` | `get_picture(session_id, group_id) -> dict[str, Any]` | The group's picture URL, or `null` when it has none. |-| `set_picture` | `set_picture(session_id, group_id, body) -> SuccessResult` | Set the group's picture. **OPERATOR** |-| `delete_picture` | `delete_picture(session_id, group_id) -> SuccessResult` | Remove the group's picture. **OPERATOR** |-| `invite_code` | `invite_code(session_id, group_id) -> InviteCodeResponse` | Get the invite code. |-| `revoke_invite_code` | `revoke_invite_code(session_id, group_id) -> InviteCodeResponse` | Revoke and regenerate the invite code. **OPERATOR** |+| Method | Signature | Description |+| ----------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |+| `list` | `list(session_id, query=None) -> list[GroupSummary]` | List groups (`query`: `limit`, `offset`). |+| `get` | `get(session_id, group_id) -> GroupInfo` | Get group details. |+| `create` | `create(session_id, body) -> GroupInfo` | Create a group. **OPERATOR** |+| `join_info` | `join_info(session_id, code) -> GroupJoinInfo` | Preview a group from its invite code WITHOUT joining. Read-only, so it is safe to call on a code from an untrusted source. |+| `join_group` | `join_group(session_id, body) -> JoinGroupResponse` | Join a group via its invite code. **OPERATOR** |+| `add_participants` | `add_participants(session_id, group_id, participants) -> SuccessResult` | Add participants (`list[str]`). **OPERATOR** |+| `remove_participants` | `remove_participants(session_id, group_id, participants) -> SuccessResult` | Remove participants. **OPERATOR** |+| `promote_participants` | `promote_participants(session_id, group_id, participants) -> SuccessResult` | Promote to admin. **OPERATOR** |+| `demote_participants` | `demote_participants(session_id, group_id, participants) -> SuccessResult` | Demote from admin. **OPERATOR** |+| `set_subject` | `set_subject(session_id, group_id, subject) -> SuccessResult` | Set group subject. **OPERATOR** |+| `set_description` | `set_description(session_id, group_id, description) -> SuccessResult` | Set group description. **OPERATOR** |+| `get_group_settings` | `get_group_settings(session_id, group_id) -> GroupSettings` | Get the group settings (announce / locked / ephemeral timer). |+| `update_group_settings` | `update_group_settings(session_id, group_id, body) -> SuccessResult` | Update the group settings (at least one field required). **OPERATOR** |+| `leave` | `leave(session_id, group_id) -> SuccessResult` | Leave the group. **OPERATOR** |+| `get_picture` | `get_picture(session_id, group_id) -> dict[str, Any]` | The group's picture URL, or `null` when it has none. |+| `set_picture` | `set_picture(session_id, group_id, body) -> SuccessResult` | Set the group's picture. **OPERATOR** |+| `delete_picture` | `delete_picture(session_id, group_id) -> SuccessResult` | Remove the group's picture. **OPERATOR** |+| `invite_code` | `invite_code(session_id, group_id) -> InviteCodeResponse` | Get the invite code. |+| `revoke_invite_code` | `revoke_invite_code(session_id, group_id) -> InviteCodeResponse` | Revoke and regenerate the invite code. **OPERATOR** |+| `get_membership_requests` | `get_membership_requests(session_id, group_id) -> list[GroupMembershipRequest]` | List a group's pending join requests. Requires group admin. **OPERATOR** |+| `approve_membership_requests` | `approve_membership_requests(session_id, group_id, participants=None) -> ParticipantsResult` | Approve pending join requests; omit the list to approve all. **OPERATOR** |+| `reject_membership_requests` | `reject_membership_requests(session_id, group_id, participants=None) -> ParticipantsResult` | Reject pending join requests; omit the list to reject all. **OPERATOR** |#### `client.chats`@@ -884,27 +890,30 @@ All payloads are associative arrays; all listed methods are synchronous and retu#### `groups`-| Method | Signature | Description |-| --------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |-| `list` | `list(string $sessionId, array $query = []): array` | List groups. |-| `get` | `get(string $sessionId, string $groupId): array` | Get one group. |-| `create` | `create(string $sessionId, array $body): array` | Create a group. **OPERATOR** |-| `joinInfo` | `joinInfo(string $sessionId, string $code): array` | Preview a group from its invite code WITHOUT joining. Read-only, so it is safe to call on a code from an untrusted source. |-| `joinGroup` | `joinGroup(string $sessionId, string $inviteCode): array` | Join a group via its invite code. **OPERATOR** |-| `addParticipants` | `addParticipants(string $sessionId, string $groupId, array $participants): array` | Add participants. **OPERATOR** |-| `removeParticipants` | `removeParticipants(string $sessionId, string $groupId, array $participants): array` | Remove participants. **OPERATOR** |-| `promoteParticipants` | `promoteParticipants(string $sessionId, string $groupId, array $participants): array` | Promote to admin. **OPERATOR** |-| `demoteParticipants` | `demoteParticipants(string $sessionId, string $groupId, array $participants): array` | Demote admins. **OPERATOR** |-| `setSubject` | `setSubject(string $sessionId, string $groupId, string $subject): array` | Update the group subject. **OPERATOR** |-| `setDescription` | `setDescription(string $sessionId, string $groupId, string $description): array` | Update the group description. **OPERATOR** |-| `getGroupSettings` | `getGroupSettings(string $sessionId, string $groupId): array` | Get the group settings (only the ones the active engine supports are present). |-| `updateGroupSettings` | `updateGroupSettings(string $sessionId, string $groupId, array $settings): array` | Update the group settings (at least one of `announce`, `locked`, `ephemeralSeconds`). **OPERATOR** |-| `leave` | `leave(string $sessionId, string $groupId): array` | Leave the group. **OPERATOR** |-| `getPicture` | `getPicture(string $sessionId, string $groupId): array` | The group's picture URL, or `null` when it has none. |-| `setPicture` | `setPicture(string $sessionId, string $groupId, array $body): array` | Set the group's picture. **OPERATOR** |-| `deletePicture` | `deletePicture(string $sessionId, string $groupId): array` | Remove the group's picture. **OPERATOR** |-| `inviteCode` | `inviteCode(string $sessionId, string $groupId): array` | Get the invite code. |-| `revokeInviteCode` | `revokeInviteCode(string $sessionId, string $groupId): array` | Revoke and regenerate the invite code. **OPERATOR** |+| Method | Signature | Description |+| --------------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |+| `list` | `list(string $sessionId, array $query = []): array` | List groups. |+| `get` | `get(string $sessionId, string $groupId): array` | Get one group. |+| `create` | `create(string $sessionId, array $body): array` | Create a group. **OPERATOR** |+| `joinInfo` | `joinInfo(string $sessionId, string $code): array` | Preview a group from its invite code WITHOUT joining. Read-only, so it is safe to call on a code from an untrusted source. |+| `joinGroup` | `joinGroup(string $sessionId, string $inviteCode): array` | Join a group via its invite code. **OPERATOR** |+| `addParticipants` | `addParticipants(string $sessionId, string $groupId, array $participants): array` | Add participants. **OPERATOR** |+| `removeParticipants` | `removeParticipants(string $sessionId, string $groupId, array $participants): array` | Remove participants. **OPERATOR** |+| `promoteParticipants` | `promoteParticipants(string $sessionId, string $groupId, array $participants): array` | Promote to admin. **OPERATOR** |+| `demoteParticipants` | `demoteParticipants(string $sessionId, string $groupId, array $participants): array` | Demote admins. **OPERATOR** |+| `setSubject` | `setSubject(string $sessionId, string $groupId, string $subject): array` | Update the group subject. **OPERATOR** |+| `setDescription` | `setDescription(string $sessionId, string $groupId, string $description): array` | Update the group description. **OPERATOR** |+| `getGroupSettings` | `getGroupSettings(string $sessionId, string $groupId): array` | Get the group settings (only the ones the active engine supports are present). |+| `updateGroupSettings` | `updateGroupSettings(string $sessionId, string $groupId, array $settings): array` | Update the group settings (at least one of `announce`, `locked`, `ephemeralSeconds`). **OPERATOR** |+| `leave` | `leave(string $sessionId, string $groupId): array` | Leave the group. **OPERATOR** |+| `getPicture` | `getPicture(string $sessionId, string $groupId): array` | The group's picture URL, or `null` when it has none. |+| `setPicture` | `setPicture(string $sessionId, string $groupId, array $body): array` | Set the group's picture. **OPERATOR** |+| `deletePicture` | `deletePicture(string $sessionId, string $groupId): array` | Remove the group's picture. **OPERATOR** |+| `inviteCode` | `inviteCode(string $sessionId, string $groupId): array` | Get the invite code. |+| `revokeInviteCode` | `revokeInviteCode(string $sessionId, string $groupId): array` | Revoke and regenerate the invite code. **OPERATOR** |+| `getMembershipRequests` | `getMembershipRequests(string $sessionId, string $groupId): array` | List a group's pending join requests. Requires group admin. **OPERATOR** |+| `approveMembershipRequests` | `approveMembershipRequests(string $sessionId, string $groupId, ?array $participants = null): array` | Approve pending join requests; omit the list to approve all. **OPERATOR** |+| `rejectMembershipRequests` | `rejectMembershipRequests(string $sessionId, string $groupId, ?array $participants = null): array` | Reject pending join requests; omit the list to reject all. **OPERATOR** |#### `chats`diff --git a/sdk/README.md b/sdk/README.mdindex fa48e5eff..1e44807de 100644--- a/sdk/README.md+++ b/sdk/README.md@@ -22,24 +22,24 @@ hand-written resource methods.All five SDKs expose the same fluent resource surface:-| Resource | Methods |-| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| `sessions` | list, get, getConfig, updateConfig, create, delete, start, stop, logout, forceKill, getQrCode, requestPairingCode, setOnlinePresence, stats |-| `messages` | list, sendText, sendImage/Video/Audio/Document/Sticker, sendLocation, sendContact, sendTemplate, sendPoll, reply, forward, react, delete, editMessage, history, reactions, media, pin, unpin, star, votePoll, sendBulk, batchStatus, cancelBatch |-| `contacts` | list, get, check, profilePicture, profilePictures, phone, upsert, delete, block, unblock |-| `groups` | list, get, create, joinGroup, joinInfo, add/remove/promote/demoteParticipants, setSubject, setDescription, get/updateGroupSettings, leave, getPicture, setPicture, deletePicture, inviteCode, revokeInviteCode |-| `webhooks` | list, listAll, deliveryFailures, get, create, update, delete, test |-| `chats` | list, markRead, markUnread, archive, clearMessages, delete, sendState, subscribePresence, getPresence |-| `labels` | list, get, chats, forChat, upsert, delete, addToChat, removeFromChat _(WhatsApp Business)_ |-| `channels` | list, get, messages, create, delete, mute, subscribe, unsubscribe _(Newsletters)_ |-| `catalog` | info, products, product, sendProduct, sendCatalog _(WhatsApp Business)_ |-| `status` | list, fromContact, media, sendText, sendImage, sendVideo, sendVoice, delete _(Stories)_ |-| `search` | search _(Operator)_ |-| `templates` | list, get, create, update, delete |-| `profile` | setProfileName, setProfileStatus, setProfilePicture _(OPERATOR)_ |-| `calls` | rejectCall _(OPERATOR)_ |-| `media` | conversionStatus, convertVoice, convertVideo _(OPERATOR)_ |-| `health` | check, live, ready |+| Resource | Methods |+| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `sessions` | list, get, getConfig, updateConfig, create, delete, start, stop, logout, forceKill, getQrCode, requestPairingCode, setOnlinePresence, stats |+| `messages` | list, sendText, sendImage/Video/Audio/Document/Sticker, sendLocation, sendContact, sendTemplate, sendPoll, reply, forward, react, delete, editMessage, history, reactions, media, pin, unpin, star, votePoll, sendBulk, batchStatus, cancelBatch |+| `contacts` | list, get, check, profilePicture, profilePictures, phone, upsert, delete, block, unblock |+| `groups` | list, get, create, joinGroup, joinInfo, add/remove/promote/demoteParticipants, setSubject, setDescription, get/updateGroupSettings, leave, getPicture, setPicture, deletePicture, inviteCode, revokeInviteCode, getMembershipRequests, approveMembershipRequests, rejectMembershipRequests |+| `webhooks` | list, listAll, deliveryFailures, get, create, update, delete, test |+| `chats` | list, markRead, markUnread, archive, clearMessages, delete, sendState, subscribePresence, getPresence |+| `labels` | list, get, chats, forChat, upsert, delete, addToChat, removeFromChat _(WhatsApp Business)_ |+| `channels` | list, get, messages, create, delete, mute, subscribe, unsubscribe _(Newsletters)_ |+| `catalog` | info, products, product, sendProduct, sendCatalog _(WhatsApp Business)_ |+| `status` | list, fromContact, media, sendText, sendImage, sendVideo, sendVoice, delete _(Stories)_ |+| `search` | search _(Operator)_ |+| `templates` | list, get, create, update, delete |+| `profile` | setProfileName, setProfileStatus, setProfilePicture _(OPERATOR)_ |+| `calls` | rejectCall _(OPERATOR)_ |+| `media` | conversionStatus, convertVoice, convertVideo _(OPERATOR)_ |+| `health` | check, live, ready |> ⚠️ Endpoints requiring an `OPERATOR`-level API key are noted in the inline> docs. Deliberately **not** exposed, matching `docs/18-sdk-design.md` exactly:diff --git a/sdk/go/groups.go b/sdk/go/groups.goindex b5a8f9c8a..151c95bf0 100644--- a/sdk/go/groups.go+++ b/sdk/go/groups.go@@ -195,3 +195,52 @@ func (s *GroupsService) RevokeInviteCode(ctx context.Context, sessionID, groupID}return &out, nil}++// GetMembershipRequests lists a group's pending join requests. Requires the account to be a group+// admin. Only ParticipantID is guaranteed on each entry — the engine reports the rest when it has it.+func (s *GroupsService) GetMembershipRequests(+ ctx context.Context, sessionID, groupID string,+) ([]GroupMembershipRequest, error) {+ var out []GroupMembershipRequest+ err := s.client.do(ctx, "GET", s.base(sessionID)+"/"+pathEscape(groupID)+"/membership-requests", nil, nil, &out)+ if err != nil {+ return nil, err+ }+ return out, nil+}++// ApproveMembershipRequests approves pending join requests. Pass a nil slice to approve every+// pending request.+//+// A partial refusal answers 200 and reports it per participant in Results, so Success alone does+// not mean everyone was let in.+func (s *GroupsService) ApproveMembershipRequests(+ ctx context.Context, sessionID, groupID string, participants []string,+) (*ParticipantsResult, error) {+ return s.membershipRequestAction(ctx, sessionID, groupID, "approve", participants)+}++// RejectMembershipRequests rejects pending join requests. Pass a nil slice to reject every pending+// request.+func (s *GroupsService) RejectMembershipRequests(+ ctx context.Context, sessionID, groupID string, participants []string,+) (*ParticipantsResult, error) {+ return s.membershipRequestAction(ctx, sessionID, groupID, "reject", participants)+}++func (s *GroupsService) membershipRequestAction(+ ctx context.Context, sessionID, groupID, verb string, participants []string,+) (*ParticipantsResult, error) {+ body := MembershipRequestActionRequest{}+ if participants != nil {+ body.Participants = participants+ }+ var out ParticipantsResult+ err := s.client.do(+ ctx, "POST", s.base(sessionID)+"/"+pathEscape(groupID)+"/membership-requests/"+verb, nil, body, &out,+ )+ if err != nil {+ return nil, err+ }+ return &out, nil+}diff --git a/sdk/go/routing_test.go b/sdk/go/routing_test.goindex dc98c8ebf..203b36a11 100644--- a/sdk/go/routing_test.go+++ b/sdk/go/routing_test.go@@ -79,6 +79,9 @@ func TestRouting(t *testing.T) {{"Groups.Leave", func(c *Client) { c.Groups.Leave(ctx, "s1", "g1") }, "POST", "/api/sessions/s1/groups/g1/leave"},{"Groups.InviteCode", func(c *Client) { c.Groups.InviteCode(ctx, "s1", "g1") }, "GET", "/api/sessions/s1/groups/g1/invite-code"},{"Groups.RevokeInviteCode", func(c *Client) { c.Groups.RevokeInviteCode(ctx, "s1", "g1") }, "POST", "/api/sessions/s1/groups/g1/invite-code/revoke"},+ {"Groups.GetMembershipRequests", func(c *Client) { c.Groups.GetMembershipRequests(ctx, "s1", "g1") }, "GET", "/api/sessions/s1/groups/g1/membership-requests"},+ {"Groups.ApproveMembershipRequests", func(c *Client) { c.Groups.ApproveMembershipRequests(ctx, "s1", "g1", nil) }, "POST", "/api/sessions/s1/groups/g1/membership-requests/approve"},+ {"Groups.RejectMembershipRequests", func(c *Client) { c.Groups.RejectMembershipRequests(ctx, "s1", "g1", nil) }, "POST", "/api/sessions/s1/groups/g1/membership-requests/reject"},{"Groups.GetGroupSettings", func(c *Client) { c.Groups.GetGroupSettings(ctx, "s1", "g1") }, "GET", "/api/sessions/s1/groups/g1/settings"},{"Groups.UpdateGroupSettings", func(c *Client) { c.Groups.UpdateGroupSettings(ctx, "s1", "g1", GroupSettings{}) }, "PUT", "/api/sessions/s1/groups/g1/settings"},diff --git a/sdk/go/types_group.go b/sdk/go/types_group.goindex 73d17d58b..b87120e38 100644--- a/sdk/go/types_group.go+++ b/sdk/go/types_group.go@@ -25,6 +25,23 @@ type GroupSummary struct {LinkedParentJID *string `json:"linkedParentJID,omitempty"`}+// GroupMembershipRequest is a pending request to join a group. Only ParticipantID is always+// present; the engine reports the rest when it has it.+type GroupMembershipRequest struct {+ ParticipantID string `json:"participantId"`+ AddedByID string `json:"addedById,omitempty"`+ // Method is one of: invite_link, non_admin_add, linked_group_join.+ Method string `json:"method,omitempty"`+ // RequestedAt is Unix seconds.+ RequestedAt float64 `json:"requestedAt,omitempty"`+}++// MembershipRequestActionRequest is the body for approving or rejecting join requests. An empty+// Participants slice acts on every pending request.+type MembershipRequestActionRequest struct {+ Participants []string `json:"participants,omitempty"`+}+// GroupInfo is the full group detail.type GroupInfo struct {ID string `json:"id"`diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/GroupMembershipRequest.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/GroupMembershipRequest.javanew file mode 100644index 000000000..5f0f2a832--- /dev/null+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/GroupMembershipRequest.java@@ -0,0 +1,14 @@+package com.rmyndharis.openwa.model;++/**+ * A pending request to join a group.+ *+ * <p>Only {@code participantId} is always present; the engine reports the rest when it has it, so+ * treat the other fields as possibly {@code null} rather than assuming a shape.+ *+ * @param participantId neutral id of the user asking to join+ * @param addedById who created the request — differs from the requester on a non-admin add+ * @param method one of {@code invite_link}, {@code non_admin_add}, {@code linked_group_join}+ * @param requestedAt Unix seconds the request was created+ */+public record GroupMembershipRequest(String participantId, String addedById, String method, Double requestedAt) {}diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/MembershipRequestActionRequest.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/MembershipRequestActionRequest.javanew file mode 100644index 000000000..77bdbb6f1--- /dev/null+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/MembershipRequestActionRequest.java@@ -0,0 +1,28 @@+package com.rmyndharis.openwa.model;++import java.util.List;++/**+ * Request body for approving or rejecting group join requests.+ *+ * <p>A {@code null} participant list acts on every pending request.+ */+public record MembershipRequestActionRequest(List<String> participants) {+ public static Builder builder() {+ return new Builder();+ }++ public static final class Builder {+ private List<String> participants;++ /** Requester WhatsApp ids. Leave unset to act on every pending request. */+ public Builder participants(List<String> v) {+ this.participants = v;+ return this;+ }++ public MembershipRequestActionRequest build() {+ return new MembershipRequestActionRequest(participants);+ }+ }+}diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/GroupsResource.java b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/GroupsResource.javaindex f0500eb70..7510cda4d 100644--- a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/GroupsResource.java+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/GroupsResource.java@@ -8,6 +8,8 @@ import com.rmyndharis.openwa.model.CreateGroupRequest;import com.rmyndharis.openwa.model.GroupDescriptionRequest;import com.rmyndharis.openwa.model.GroupInfo;import com.rmyndharis.openwa.model.GroupJoinInfo;+import com.rmyndharis.openwa.model.GroupMembershipRequest;+import com.rmyndharis.openwa.model.MembershipRequestActionRequest;import com.rmyndharis.openwa.model.GroupSettings;import com.rmyndharis.openwa.model.GroupSubjectRequest;import com.rmyndharis.openwa.model.GroupSummary;@@ -228,4 +230,49 @@ public final class GroupsResource {null,InviteCodeResponse.class);}++ /**+ * List a group's pending join requests. Requires the account to be a group admin.+ *+ * <p>Only {@code participantId} is guaranteed on each entry — the engine reports the rest when+ * it has it.+ */+ public List<GroupMembershipRequest> getMembershipRequests(String sessionId, String groupId) {+ return client.requestList(+ HttpMethod.GET,+ "/api/sessions/" + encodeSegment(sessionId) + "/groups/" + encodeSegment(groupId) + "/membership-requests",+ null,+ null,+ GroupMembershipRequest.class);+ }++ /**+ * Approve pending join requests. A body with no participants approves every pending request.+ *+ * <p>A partial refusal answers 200 and reports it per participant in {@code results}, so+ * {@code success} alone does not mean everyone was let in.+ */+ public ParticipantsResult approveMembershipRequests(+ String sessionId, String groupId, MembershipRequestActionRequest body) {+ return client.request(+ HttpMethod.POST,+ "/api/sessions/" + encodeSegment(sessionId) + "/groups/" + encodeSegment(groupId)+ + "/membership-requests/approve",+ null,+ body,+ ParticipantsResult.class);+ }++ /** Reject pending join requests. A body with no participants rejects every pending request. */+ public ParticipantsResult rejectMembershipRequests(+ String sessionId, String groupId, MembershipRequestActionRequest body) {+ return client.request(+ HttpMethod.POST,+ "/api/sessions/" + encodeSegment(sessionId) + "/groups/" + encodeSegment(groupId)+ + "/membership-requests/reject",+ null,+ body,+ ParticipantsResult.class);+ }+}diff --git a/sdk/java/src/test/java/com/rmyndharis/openwa/resources/GroupsResourceTest.java b/sdk/java/src/test/java/com/rmyndharis/openwa/resources/GroupsResourceTest.javaindex 384d1e171..e0f18085e 100644--- a/sdk/java/src/test/java/com/rmyndharis/openwa/resources/GroupsResourceTest.java+++ b/sdk/java/src/test/java/com/rmyndharis/openwa/resources/GroupsResourceTest.java@@ -12,6 +12,7 @@ import com.rmyndharis.openwa.model.SetGroupPictureRequest;import com.rmyndharis.openwa.model.CreateGroupRequest;import com.rmyndharis.openwa.model.GroupSettings;import com.rmyndharis.openwa.model.ListGroupsQuery;+import com.rmyndharis.openwa.model.MembershipRequestActionRequest;import com.rmyndharis.openwa.support.MockTransport;import java.util.List;import org.junit.jupiter.api.Test;@@ -205,4 +206,24 @@ class GroupsResourceTest {client.groups.deletePicture("s", "[email protected]");assertEquals(HttpMethod.DELETE, tx.lastRequest().method());}++ @Test+ void membershipRequestsListApproveReject() {+ tx.respond(200, "[{\"participantId\":\"[email protected]\",\"method\":\"invite_link\"}]");+ var pending = client.groups.getMembershipRequests("s", "[email protected]");+ assertEquals(HttpMethod.GET, tx.lastRequest().method());+ assertTrue(tx.lastRequest().url().endsWith("/groups/[email protected]/membership-requests"));+ assertEquals("[email protected]", pending.get(0).participantId());++ tx.respond(200, "{\"success\":true,\"message\":\"ok\",\"results\":[]}");+ client.groups.approveMembershipRequests(+ "s", "[email protected]", MembershipRequestActionRequest.builder().participants(List.of("[email protected]")).build());+ assertTrue(tx.lastRequest().url().endsWith("/membership-requests/approve"));+ assertTrue(tx.lastRequest().body().contains("[email protected]"));++ tx.respond(200, "{\"success\":true,\"message\":\"ok\",\"results\":[]}");+ client.groups.rejectMembershipRequests("s", "[email protected]", MembershipRequestActionRequest.builder().build());+ assertTrue(tx.lastRequest().url().endsWith("/membership-requests/reject"));+ }+}diff --git a/sdk/javascript/src/resources/groups.ts b/sdk/javascript/src/resources/groups.tsindex 4c4ee3784..71b6a559c 100644--- a/sdk/javascript/src/resources/groups.ts+++ b/sdk/javascript/src/resources/groups.ts@@ -11,6 +11,7 @@ import type {CreateGroupRequest,GroupInfo,GroupJoinInfo,+ GroupMembershipRequest,GroupSettingsResponse,GroupSummary,InviteCodeResponse,@@ -207,4 +208,40 @@ export class GroupsResource {path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/invite-code/revoke`,});}++ /**+ * List a group's pending join requests. Requires the account to be a group admin.+ *+ * Only `participantId` is guaranteed — the rest of each entry is reported by the engine when it+ * has it, so treat `addedById`, `method` and `requestedAt` as absent rather than assuming a shape.+ */+ getMembershipRequests(sessionId: string, groupId: string): Promise<GroupMembershipRequest[]> {+ return this.client.request<GroupMembershipRequest[]>({+ method: 'GET',+ path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/membership-requests`,+ });+ }++ /**+ * Approve pending join requests. Omit `participants` to approve every pending request.+ *+ * A partial refusal answers 200 and reports it per participant in `results`, so `success` alone+ * does not mean everyone was let in.+ */+ approveMembershipRequests(sessionId: string, groupId: string, participants?: string[]): Promise<ParticipantsResult> {+ return this.client.request<ParticipantsResult>({+ method: 'POST',+ path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/membership-requests/approve`,+ body: participants === undefined ? {} : { participants },+ });+ }++ /** Reject pending join requests. Omit `participants` to reject every pending request. */+ rejectMembershipRequests(sessionId: string, groupId: string, participants?: string[]): Promise<ParticipantsResult> {+ return this.client.request<ParticipantsResult>({+ method: 'POST',+ path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/membership-requests/reject`,+ body: participants === undefined ? {} : { participants },+ });+ }}diff --git a/sdk/javascript/src/types.ts b/sdk/javascript/src/types.tsindex 5790198e3..f64f986d9 100644--- a/sdk/javascript/src/types.ts+++ b/sdk/javascript/src/types.ts@@ -626,6 +626,20 @@ export interface GroupInfo {linkedParentJID?: string | null;}+/** How a pending join request was made, when the engine reports it. */+export type GroupMembershipRequestMethod = 'invite_link' | 'non_admin_add' | 'linked_group_join';++/** A pending request to join a group. Only `participantId` is always present. */+export interface GroupMembershipRequest {+ /** Neutral id of the user asking to join. */+ participantId: Jid;+ /** Who created the request — differs from the requester on a non-admin add. */+ addedById?: Jid;+ method?: GroupMembershipRequestMethod;+ /** Unix seconds the request was created. */+ requestedAt?: number;+}+export interface CreateGroupRequest {name: string;participants: Jid[];diff --git a/sdk/javascript/test/resources.test.ts b/sdk/javascript/test/resources.test.tsindex a0f969e7c..3f4b5d9d4 100644--- a/sdk/javascript/test/resources.test.ts+++ b/sdk/javascript/test/resources.test.ts@@ -58,6 +58,29 @@ describe('GroupsResource — exact paths and bodies', () => {expect(t.lastCall!.url).toContain('/invite-code/revoke');});+ it('membership requests — list, approve, reject', async () => {+ const t = new MockTransport()+ .on('GET', /\/membership-requests$/, { body: [{ participantId: '[email protected]', method: 'invite_link' }] })+ .on('POST', /\/membership-requests\/approve$/, { body: { success: true, message: 'ok', results: [] } })+ .on('POST', /\/membership-requests\/reject$/, { body: { success: true, message: 'ok', results: [] } });+ const c = client(t);++ const pending = await c.groups.getMembershipRequests('s', '[email protected]');+ expect(t.lastCall!.method).toBe('GET');+ expect(t.lastCall!.url).toContain('/groups/[email protected]/membership-requests');+ expect(pending[0].participantId).toBe('[email protected]');++ await c.groups.approveMembershipRequests('s', '[email protected]', ['[email protected]']);+ expect(t.lastCall!.url).toContain('/membership-requests/approve');+ expect(t.lastCall!.body).toEqual({ participants: ['[email protected]'] });++ // Omitting the list means "every pending request" — it must send an empty object, not+ // `{ participants: undefined }`, which would read as an explicit empty selection.+ await c.groups.rejectMembershipRequests('s', '[email protected]');+ expect(t.lastCall!.url).toContain('/membership-requests/reject');+ expect(t.lastCall!.body).toEqual({});+ });+it('joinGroup posts the invite code to /groups/join', async () => {const t = new MockTransport().on('POST', /\/groups\/join$/, { body: { success: true, groupId: '[email protected]' } });const res = await client(t).groups.joinGroup('s', { inviteCode: 'AbCdEf' });diff --git a/sdk/php/src/Resources/GroupsResource.php b/sdk/php/src/Resources/GroupsResource.phpindex 737a5d7bc..c38cf7b35 100644--- a/sdk/php/src/Resources/GroupsResource.php+++ b/sdk/php/src/Resources/GroupsResource.php@@ -176,4 +176,46 @@ class GroupsResource{return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/groups/{$this->http->encodeSegment($groupId)}/invite-code/revoke");}++ /**+ * List a group's pending join requests. Requires the account to be a group admin.+ *+ * Only `participantId` is guaranteed on each entry — the engine reports the rest when it has it.+ *+ * @return array<int,array<string,mixed>>+ */+ public function getMembershipRequests(string $sessionId, string $groupId): array+ {+ return $this->http->request('GET', "/api/sessions/{$this->http->encodeSegment($sessionId)}/groups/{$this->http->encodeSegment($groupId)}/membership-requests") ?? [];+ }++ /**+ * Approve pending join requests. Pass null to approve every pending request.+ *+ * A partial refusal answers 200 and reports it per participant in `results`, so `success` alone+ * does not mean everyone was let in.+ *+ * @param list<string>|null $participants+ * @return array<string,mixed>+ */+ public function approveMembershipRequests(string $sessionId, string $groupId, ?array $participants = null): array+ {+ $body = $participants === null ? [] : ['participants' => $participants];++ return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/groups/{$this->http->encodeSegment($groupId)}/membership-requests/approve", [], $body);+ }++ /**+ * Reject pending join requests. Pass null to reject every pending request.+ *+ * @param list<string>|null $participants+ * @return array<string,mixed>+ */+ public function rejectMembershipRequests(string $sessionId, string $groupId, ?array $participants = null): array+ {+ $body = $participants === null ? [] : ['participants' => $participants];++ return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/groups/{$this->http->encodeSegment($groupId)}/membership-requests/reject", [], $body);+ }+}diff --git a/sdk/php/tests/ResourcesTest.php b/sdk/php/tests/ResourcesTest.phpindex b7c83fc8a..834d46b29 100644--- a/sdk/php/tests/ResourcesTest.php+++ b/sdk/php/tests/ResourcesTest.php@@ -406,4 +406,28 @@ class ResourcesTest extends TestCase$this->assertSame('POST', $backend->calls()[3]['method']);$this->assertStringContainsString('/auth/validate', $backend->calls()[3]['url']);}++ public function testGroupMembershipRequests(): void+ {+ $backend = new MockBackend();+ $backend->on(200, [['participantId' => '[email protected]', 'method' => 'invite_link']]);+ $backend->on(200, ['success' => true, 'message' => 'ok', 'results' => []]);+ $backend->on(200, ['success' => true, 'message' => 'ok', 'results' => []]);+ $client = $backend->makeClient();++ $pending = $client->groups->getMembershipRequests('s', '[email protected]');+ $this->assertSame('GET', $backend->lastCall()['method']);+ $this->assertStringEndsWith('/groups/[email protected]/membership-requests', $backend->lastCall()['url']);+ $this->assertSame('[email protected]', $pending[0]['participantId']);++ $client->groups->approveMembershipRequests('s', '[email protected]', ['[email protected]']);+ $this->assertStringEndsWith('/membership-requests/approve', $backend->lastCall()['url']);+ $this->assertSame(['participants' => ['[email protected]']], $backend->lastCall()['body']);++ // Omitting the list means "every pending request": an empty body, not a null participants key.+ $client->groups->rejectMembershipRequests('s', '[email protected]');+ $this->assertStringEndsWith('/membership-requests/reject', $backend->lastCall()['url']);+ $this->assertSame([], $backend->lastCall()['body']);+ }+}diff --git a/sdk/python/openwa/resources/groups.py b/sdk/python/openwa/resources/groups.pyindex fa90c59be..24cd6dde2 100644--- a/sdk/python/openwa/resources/groups.py+++ b/sdk/python/openwa/resources/groups.py@@ -10,6 +10,7 @@ from typing import Any, TYPE_CHECKING, TypedDictfrom .._http import quote_segmentfrom ..types import (GroupJoinInfo,+ GroupMembershipRequest,SetGroupPictureRequest,CreateGroupRequest,GroupInfo,@@ -144,3 +145,42 @@ class GroupsResource:return self._http.request("PUT", f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}/settings", body=body)++ def get_membership_requests(self, session_id: str, group_id: str) -> list[GroupMembershipRequest]:+ """List a group's pending join requests. Requires the account to be a group admin.++ Only ``participantId`` is guaranteed on each entry — the rest is reported by the engine when+ it has it.+ """+ return self._http.request(+ "GET",+ f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}/membership-requests",+ )++ def approve_membership_requests(+ self, session_id: str, group_id: str, participants: list[str] | None = None+ ) -> ParticipantsResult:+ """Approve pending join requests. Omit ``participants`` to approve every pending request.++ A partial refusal answers 200 and reports it per participant in ``results``, so ``success``+ alone does not mean everyone was let in.+ """+ body: dict[str, object] = {} if participants is None else {"participants": participants}+ return self._http.request(+ "POST",+ f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}"+ "/membership-requests/approve",+ body=body,+ )++ def reject_membership_requests(+ self, session_id: str, group_id: str, participants: list[str] | None = None+ ) -> ParticipantsResult:+ """Reject pending join requests. Omit ``participants`` to reject every pending request."""+ body: dict[str, object] = {} if participants is None else {"participants": participants}+ return self._http.request(+ "POST",+ f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}"+ "/membership-requests/reject",+ body=body,+ )diff --git a/sdk/python/openwa/types.py b/sdk/python/openwa/types.pyindex f287e2ff3..d635dc600 100644--- a/sdk/python/openwa/types.py+++ b/sdk/python/openwa/types.py@@ -603,6 +603,22 @@ class GroupSummary(TypedDict, total=False):linkedParentJID: str | None+GroupMembershipRequestMethod = Literal["invite_link", "non_admin_add", "linked_group_join"]+++class GroupMembershipRequest(TypedDict, total=False):+ """A pending request to join a group.++ Only ``participantId`` is always present; the engine reports the rest when it has it, so treat+ ``addedById``, ``method`` and ``requestedAt`` as absent rather than assuming a shape.+ """++ participantId: str+ addedById: str+ method: GroupMembershipRequestMethod+ requestedAt: float++class GroupInfo(TypedDict, total=False):"""Full detail returned by ``GET /sessions/:id/groups/:groupId``."""diff --git a/sdk/python/tests/test_sdk.py b/sdk/python/tests/test_sdk.pyindex 4239fdbaf..78f9bfd13 100644--- a/sdk/python/tests/test_sdk.py+++ b/sdk/python/tests/test_sdk.py@@ -825,3 +825,26 @@ class TestSearch:assert "q=x" in urlassert "limit=5" in urlassert "sessionId" not in url+++class TestGroupMembershipRequests:+ def test_list_approve_reject(self):+ backend = MockBackend()+ backend.on("GET", "/membership-requests", body=[{"participantId": "[email protected]", "method": "invite_link"}])+ backend.on("POST", "/membership-requests/approve", body={"success": True, "message": "ok", "results": []})+ backend.on("POST", "/membership-requests/reject", body={"success": True, "message": "ok", "results": []})+ client = make_client(backend)++ pending = client.groups.get_membership_requests("s", "[email protected]")+ assert backend.calls[-1].method == "GET"+ assert backend.calls[-1].url.endswith("/groups/[email protected]/membership-requests")+ assert pending[0]["participantId"] == "[email protected]"++ client.groups.approve_membership_requests("s", "[email protected]", ["[email protected]"])+ assert backend.calls[-1].url.endswith("/membership-requests/approve")+ assert backend.calls[-1].body == {"participants": ["[email protected]"]}++ # Omitting the list means "every pending request": an empty body, not a null participants key.+ client.groups.reject_membership_requests("s", "[email protected]")+ assert backend.calls[-1].url.endswith("/membership-requests/reject")+ assert backend.calls[-1].body == {}