Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(sdk): decode the responses the API actually sends

Yudhi Armyndharis391e84faff8e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e47be012..fb16017b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **A post-connect group-name hydration WhatsApp never answered no longer finishes without a word** — the read shared the ambiguity `GET /sessions/{id}/groups` was bounded against in 0.14.5, where an unanswered query and an account with no groups both yield an empty result, but only the REST caller got a clock: the hydration step logged neither its success line nor its failure line, so group chats stayed unnamed with nothing to explain it.
- **The published OpenAPI document is schema-valid again** — `@nestjs/swagger` expands an `@All()` route over its own method list, which includes `search`, and the 3.0 Path Item Object has no field for it, so the ingress route contributed a key that made strict validators reject the whole 150-path document rather than just that route; the export now drops operations the specification cannot express, and nothing in the repository validated the document to catch it.
+- ⚠️ **Breaking (SDK types only, no gateway change). Three response shapes the SDKs decoded into the wrong type** — the four group membership writes answer with a per-participant `results` array that a partial refusal is reported in, and all four typed SDKs declared only `{success, message}`, so a rejected member was indistinguishable from a fully applied batch; `ContactRecord` declared `pushname` where both engines emit `pushName` (which left Java's case-sensitive binder returning null for every contact), carried an `isBusiness` the API never sends, and omitted `isBlocked` and `profilePicUrl`; and `send-product` answers with `id` while the SDKs decoded `messageId`.
+ **Migration.** `addParticipants`/`removeParticipants`/`promoteParticipants`/`demoteParticipants` now return `ParticipantsResult` — a superset of the old type, so existing reads of `success`/`message` keep compiling. `ContactRecord.pushname` becomes `pushName` and `isBusiness` is gone; both were always empty. `sendProduct` returns `ProductMessageResponse { id }`.
## [0.14.5] - 2026-08-08
diff --git a/sdk/go/catalog.go b/sdk/go/catalog.go
index e8aeeaf7e..a37c19e80 100644
--- a/sdk/go/catalog.go
+++ b/sdk/go/catalog.go
@@ -43,8 +43,8 @@ func (s *CatalogService) Product(ctx context.Context, sessionID, productID strin
}
// SendProduct sends a product message. Requires an OPERATOR-level key.
-func (s *CatalogService) SendProduct(ctx context.Context, sessionID string, body SendProductRequest) (*MessageResponse, error) {
- var out MessageResponse
+func (s *CatalogService) SendProduct(ctx context.Context, sessionID string, body SendProductRequest) (*ProductMessageResponse, error) {
+ var out ProductMessageResponse
err := s.client.do(ctx, "POST", s.sessionBase(sessionID)+"/messages/send-product", nil, body, &out)
if err != nil {
return nil, err
diff --git a/sdk/go/groups.go b/sdk/go/groups.go
index ef267dfed..ffb8d0af2 100644
--- a/sdk/go/groups.go
+++ b/sdk/go/groups.go
@@ -86,27 +86,27 @@ func (s *GroupsService) UpdateGroupSettings(ctx context.Context, sessionID, grou
}
// AddParticipants adds members to a group.
-func (s *GroupsService) AddParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*SuccessResult, error) {
+func (s *GroupsService) AddParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*ParticipantsResult, error) {
return s.participants(ctx, "POST", sessionID, groupID, "/participants", participants)
}
// RemoveParticipants removes members from a group.
-func (s *GroupsService) RemoveParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*SuccessResult, error) {
+func (s *GroupsService) RemoveParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*ParticipantsResult, error) {
return s.participants(ctx, "DELETE", sessionID, groupID, "/participants", participants)
}
// PromoteParticipants promotes members to admin.
-func (s *GroupsService) PromoteParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*SuccessResult, error) {
+func (s *GroupsService) PromoteParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*ParticipantsResult, error) {
return s.participants(ctx, "POST", sessionID, groupID, "/participants/promote", participants)
}
// DemoteParticipants demotes admins to member.
-func (s *GroupsService) DemoteParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*SuccessResult, error) {
+func (s *GroupsService) DemoteParticipants(ctx context.Context, sessionID, groupID string, participants []string) (*ParticipantsResult, error) {
return s.participants(ctx, "POST", sessionID, groupID, "/participants/demote", participants)
}
-func (s *GroupsService) participants(ctx context.Context, method, sessionID, groupID, suffix string, participants []string) (*SuccessResult, error) {
- var out SuccessResult
+func (s *GroupsService) participants(ctx context.Context, method, sessionID, groupID, suffix string, participants []string) (*ParticipantsResult, error) {
+ var out ParticipantsResult
body := map[string][]string{"participants": participants}
err := s.client.do(ctx, method, s.base(sessionID)+"/"+pathEscape(groupID)+suffix, nil, body, &out)
if err != nil {
diff --git a/sdk/go/types.go b/sdk/go/types.go
index 7b72c9eb5..52fd1dba1 100644
--- a/sdk/go/types.go
+++ b/sdk/go/types.go
@@ -20,3 +20,32 @@ type SuccessResult struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
+
+// ParticipantResult is one entry per requested participant, in the order they were requested.
+//
+// Success is true only when the engine confirmed the change for this participant. Engines that
+// confirm the batch rather than each member report one success entry per requested id, so a true
+// here does not always mean the engine spoke about that participant individually.
+type ParticipantResult struct {
+ ID string `json:"id"`
+ Success bool `json:"success"`
+ Status int `json:"status,omitempty"`
+}
+
+// ParticipantsResult is the response of the group membership writes.
+//
+// A partial refusal does NOT fail the batch — the request answers 200 and reports the
+// per-participant outcome in Results, so Success alone hides a member that was rejected.
+type ParticipantsResult struct {
+ Success bool `json:"success"`
+ Message string `json:"message,omitempty"`
+ Results []ParticipantResult `json:"results"`
+}
+
+// ProductMessageResponse is the response of send-product.
+//
+// The route answers with the sent message's id under "id", not the "messageId" the other send
+// routes use.
+type ProductMessageResponse struct {
+ ID string `json:"id"`
+}
diff --git a/sdk/go/types_contact.go b/sdk/go/types_contact.go
index d259dafc6..b1d128c9f 100644
--- a/sdk/go/types_contact.go
+++ b/sdk/go/types_contact.go
@@ -3,13 +3,17 @@ package openwa
import "net/url"
// ContactRecord is a contact.
+//
+// IsBlocked is best-effort: the Baileys adapter does not track blocklist state and always reports
+// false.
type ContactRecord struct {
- ID string `json:"id"`
- Name *string `json:"name,omitempty"`
- Number *string `json:"number,omitempty"`
- Pushname *string `json:"pushname,omitempty"`
- IsBusiness bool `json:"isBusiness,omitempty"`
- IsMyContact bool `json:"isMyContact,omitempty"`
+ ID string `json:"id"`
+ Name *string `json:"name,omitempty"`
+ Number *string `json:"number,omitempty"`
+ PushName *string `json:"pushName,omitempty"`
+ IsMyContact bool `json:"isMyContact,omitempty"`
+ IsBlocked bool `json:"isBlocked,omitempty"`
+ ProfilePicURL *string `json:"profilePicUrl,omitempty"`
}
// CheckNumberResponse reports whether a number is on WhatsApp.
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ContactRecord.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ContactRecord.java
index 00319e8e6..4890964f9 100644
--- a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ContactRecord.java
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ContactRecord.java
@@ -1,10 +1,16 @@
package com.rmyndharis.openwa.model;
-/** A contact known to a session. Optional fields are {@code null} when absent. */
+/**
+ * A contact known to a session. Optional fields are {@code null} when absent.
+ *
+ * <p>{@code isBlocked} is best-effort: the Baileys adapter does not track blocklist state and always
+ * reports false.
+ */
public record ContactRecord(
String id,
String name,
String number,
- String pushname,
- Boolean isBusiness,
- Boolean isMyContact) {}
+ String pushName,
+ Boolean isMyContact,
+ Boolean isBlocked,
+ String profilePicUrl) {}
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ParticipantResult.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ParticipantResult.java
new file mode 100644
index 000000000..a08d15b4b
--- /dev/null
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ParticipantResult.java
@@ -0,0 +1,14 @@
+package com.rmyndharis.openwa.model;
+
+/**
+ * One entry per requested participant, in the order they were requested.
+ *
+ * <p>{@code success} is true only when the engine confirmed the change for this participant. Engines
+ * that confirm the batch rather than each member report one success entry per requested id, so a
+ * true here does not always mean the engine spoke about that participant individually.
+ *
+ * @param id neutral participant id the outcome belongs to
+ * @param success whether the engine confirmed the change for this participant
+ * @param status the engine's own status code, when it gave one
+ */
+public record ParticipantResult(String id, boolean success, Integer status) {}
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ParticipantsResult.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ParticipantsResult.java
new file mode 100644
index 000000000..05882528e
--- /dev/null
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ParticipantsResult.java
@@ -0,0 +1,16 @@
+package com.rmyndharis.openwa.model;
+
+import java.util.List;
+
+/**
+ * Response of the group membership writes.
+ *
+ * <p>A partial refusal does NOT fail the batch — the request answers 200 and reports the
+ * per-participant outcome in {@code results}, so {@code success} alone hides a member that was
+ * rejected.
+ *
+ * @param success always true; a failure is reported as a non-2xx status
+ * @param message human-readable summary
+ * @param results one entry per requested participant
+ */
+public record ParticipantsResult(boolean success, String message, List<ParticipantResult> results) {}
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ProductMessageResponse.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ProductMessageResponse.java
new file mode 100644
index 000000000..2d9dcd6d1
--- /dev/null
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ProductMessageResponse.java
@@ -0,0 +1,11 @@
+package com.rmyndharis.openwa.model;
+
+/**
+ * Response of {@code send-product}.
+ *
+ * <p>The route answers with the sent message's id under {@code id}, not the {@code messageId} the
+ * other send routes use.
+ *
+ * @param id id of the sent product message
+ */
+public record ProductMessageResponse(String id) {}
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/CatalogResource.java b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/CatalogResource.java
index f97c19308..104dd9887 100644
--- a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/CatalogResource.java
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/CatalogResource.java
@@ -10,6 +10,7 @@ import com.rmyndharis.openwa.model.CatalogProductsQuery;
import com.rmyndharis.openwa.model.MessageResponse;
import com.rmyndharis.openwa.model.PaginatedProducts;
import com.rmyndharis.openwa.model.SendCatalogRequest;
+import com.rmyndharis.openwa.model.ProductMessageResponse;
import com.rmyndharis.openwa.model.SendProductRequest;
/**
@@ -54,13 +55,13 @@ public final class CatalogResource {
}
/** Send a product message. Requires an OPERATOR-level key. Shares the messages path. */
- public MessageResponse sendProduct(String sessionId, SendProductRequest body) {
+ public ProductMessageResponse sendProduct(String sessionId, SendProductRequest body) {
return client.request(
HttpMethod.POST,
"/api/sessions/" + encodeSegment(sessionId) + "/messages/send-product",
null,
body,
- MessageResponse.class);
+ ProductMessageResponse.class);
}
/** Send a catalog link message. Requires an OPERATOR-level key. Shares the messages path. */
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.java
index 75bebab8e..4f9550ed8 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
@@ -18,6 +18,7 @@ import com.rmyndharis.openwa.model.JoinGroupRequest;
import com.rmyndharis.openwa.model.JoinGroupResponse;
import com.rmyndharis.openwa.model.ListGroupsQuery;
import com.rmyndharis.openwa.model.ParticipantsRequest;
+import com.rmyndharis.openwa.model.ParticipantsResult;
import com.rmyndharis.openwa.model.SuccessResult;
import java.util.List;
@@ -57,43 +58,43 @@ public final class GroupsResource {
}
/** Add participants to a group. */
- public SuccessResult addParticipants(String sessionId, String groupId, List<String> participants) {
+ public ParticipantsResult addParticipants(String sessionId, String groupId, List<String> participants) {
return client.request(
HttpMethod.POST,
"/api/sessions/" + encodeSegment(sessionId) + "/groups/" + encodeSegment(groupId) + "/participants",
null,
new ParticipantsRequest(participants),
- SuccessResult.class);
+ ParticipantsResult.class);
}
/** Remove participants from a group. */
- public SuccessResult removeParticipants(String sessionId, String groupId, List<String> participants) {
+ public ParticipantsResult removeParticipants(String sessionId, String groupId, List<String> participants) {
return client.request(
HttpMethod.DELETE,
"/api/sessions/" + encodeSegment(sessionId) + "/groups/" + encodeSegment(groupId) + "/participants",
null,
new ParticipantsRequest(participants),
- SuccessResult.class);
+ ParticipantsResult.class);
}
/** Promote participants to group admin. */
- public SuccessResult promoteParticipants(String sessionId, String groupId, List<String> participants) {
+ public ParticipantsResult promoteParticipants(String sessionId, String groupId, List<String> participants) {
return client.request(
HttpMethod.POST,
"/api/sessions/" + encodeSegment(sessionId) + "/groups/" + encodeSegment(groupId) + "/participants/promote",
null,
new ParticipantsRequest(participants),
- SuccessResult.class);
+ ParticipantsResult.class);
}
/** Demote participants from group admin. */
- public SuccessResult demoteParticipants(String sessionId, String groupId, List<String> participants) {
+ public ParticipantsResult demoteParticipants(String sessionId, String groupId, List<String> participants) {
return client.request(
HttpMethod.POST,
"/api/sessions/" + encodeSegment(sessionId) + "/groups/" + encodeSegment(groupId) + "/participants/demote",
null,
new ParticipantsRequest(participants),
- SuccessResult.class);
+ ParticipantsResult.class);
}
/** Update the group subject (name). */
diff --git a/sdk/javascript/src/resources/catalog.ts b/sdk/javascript/src/resources/catalog.ts
index c4c24f246..58d20d0be 100644
--- a/sdk/javascript/src/resources/catalog.ts
+++ b/sdk/javascript/src/resources/catalog.ts
@@ -18,6 +18,7 @@ import type {
MessageResponse,
PaginatedProducts,
SendCatalogRequest,
+ ProductMessageResponse,
SendProductRequest,
} from '../types.js';
@@ -50,8 +51,8 @@ export class CatalogResource {
}
/** Send a product message. Requires an OPERATOR-level key. Shares the messages path. */
- sendProduct(sessionId: string, body: SendProductRequest): Promise<MessageResponse> {
- return this.client.request<MessageResponse>({
+ sendProduct(sessionId: string, body: SendProductRequest): Promise<ProductMessageResponse> {
+ return this.client.request<ProductMessageResponse>({
method: 'POST',
path: `/api/sessions/${encodeSegment(sessionId)}/messages/send-product`,
body,
diff --git a/sdk/javascript/src/resources/groups.ts b/sdk/javascript/src/resources/groups.ts
index 7bdf9f6c5..5b3b9a3b7 100644
--- a/sdk/javascript/src/resources/groups.ts
+++ b/sdk/javascript/src/resources/groups.ts
@@ -17,6 +17,7 @@ import type {
SetGroupPictureRequest,
JoinGroupRequest,
JoinGroupResponse,
+ ParticipantsResult,
SuccessResult,
UpdateGroupSettingsRequest,
} from '../types.js';
@@ -80,8 +81,8 @@ export class GroupsResource {
}
/** Add participants to a group. */
- addParticipants(sessionId: string, groupId: string, participants: string[]): Promise<SuccessResult> {
- return this.client.request<SuccessResult>({
+ addParticipants(sessionId: string, groupId: string, participants: string[]): Promise<ParticipantsResult> {
+ return this.client.request<ParticipantsResult>({
method: 'POST',
path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/participants`,
body: { participants },
@@ -89,8 +90,8 @@ export class GroupsResource {
}
/** Remove participants from a group. */
- removeParticipants(sessionId: string, groupId: string, participants: string[]): Promise<SuccessResult> {
- return this.client.request<SuccessResult>({
+ removeParticipants(sessionId: string, groupId: string, participants: string[]): Promise<ParticipantsResult> {
+ return this.client.request<ParticipantsResult>({
method: 'DELETE',
path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/participants`,
body: { participants },
@@ -98,8 +99,8 @@ export class GroupsResource {
}
/** Promote participants to group admin. */
- promoteParticipants(sessionId: string, groupId: string, participants: string[]): Promise<SuccessResult> {
- return this.client.request<SuccessResult>({
+ promoteParticipants(sessionId: string, groupId: string, participants: string[]): Promise<ParticipantsResult> {
+ return this.client.request<ParticipantsResult>({
method: 'POST',
path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/participants/promote`,
body: { participants },
@@ -107,8 +108,8 @@ export class GroupsResource {
}
/** Demote participants from group admin. */
- demoteParticipants(sessionId: string, groupId: string, participants: string[]): Promise<SuccessResult> {
- return this.client.request<SuccessResult>({
+ demoteParticipants(sessionId: string, groupId: string, participants: string[]): Promise<ParticipantsResult> {
+ return this.client.request<ParticipantsResult>({
method: 'POST',
path: `/api/sessions/${encodeSegment(sessionId)}/groups/${encodeSegment(groupId)}/participants/demote`,
body: { participants },
diff --git a/sdk/javascript/src/types.ts b/sdk/javascript/src/types.ts
index bc1fde3bd..6e6dd641a 100644
--- a/sdk/javascript/src/types.ts
+++ b/sdk/javascript/src/types.ts
@@ -36,6 +36,28 @@ export interface SuccessResult {
message?: string;
}
+/** One entry per requested participant, in the order they were requested. */
+export interface ParticipantResult {
+ /** Neutral participant id the outcome belongs to. */
+ id: string;
+ /**
+ * True only when the engine confirmed the change for this participant. Engines that confirm the
+ * batch rather than each member report one success entry per requested id, so `true` does not
+ * always mean the engine spoke about that participant individually.
+ */
+ success: boolean;
+ /** The engine's own status code, when it gave one. */
+ status?: number;
+}
+
+/**
+ * The group membership writes. A partial refusal does NOT fail the batch — the request answers 200
+ * and reports the per-participant outcome here, so `success` alone hides a member that was rejected.
+ */
+export interface ParticipantsResult extends SuccessResult {
+ results: ParticipantResult[];
+}
+
// ── Session ───────────────────────────────────────────────────────
export interface SessionResponse {
@@ -521,9 +543,15 @@ export interface ContactRecord {
id: Jid;
name?: string | null;
number?: string | null;
- pushname?: string | null;
- isBusiness?: boolean;
+ /** The name the contact set on their own account. Both engines emit this as `pushName`. */
+ pushName?: string | null;
isMyContact?: boolean;
+ /**
+ * Whether the account has blocked this contact. Reported best-effort: the Baileys adapter does not
+ * track blocklist state and always reports `false`.
+ */
+ isBlocked?: boolean;
+ profilePicUrl?: string | null;
}
export interface CheckNumberResponse {
@@ -991,6 +1019,14 @@ export interface PaginatedProducts {
pagination: { page: number; limit: number; total: number; totalPages: number };
}
+/**
+ * Response of `send-product`. The route answers with the sent message's id under `id`, not the
+ * `messageId` the other send routes use.
+ */
+export interface ProductMessageResponse {
+ id: string;
+}
+
export interface SendProductRequest {
chatId: Jid;
productId: string;
diff --git a/sdk/python/openwa/resources/catalog.py b/sdk/python/openwa/resources/catalog.py
index 3de8ba5d1..fb41a3e39 100644
--- a/sdk/python/openwa/resources/catalog.py
+++ b/sdk/python/openwa/resources/catalog.py
@@ -19,6 +19,7 @@ from ..types import (
MessageResponse,
PaginatedProducts,
SendCatalogRequest,
+ ProductMessageResponse,
SendProductRequest,
)
@@ -45,7 +46,7 @@ class CatalogResource:
"GET", f"/api/sessions/{quote_segment(session_id)}/catalog/products/{quote_segment(product_id)}"
)
- def send_product(self, session_id: str, body: SendProductRequest) -> MessageResponse:
+ def send_product(self, session_id: str, body: SendProductRequest) -> ProductMessageResponse:
"""Send a product message. Requires an OPERATOR-level key. Shares the messages path."""
return self._http.request(
"POST", f"/api/sessions/{quote_segment(session_id)}/messages/send-product", body=body
diff --git a/sdk/python/openwa/resources/groups.py b/sdk/python/openwa/resources/groups.py
index c929de71c..cccab3cf3 100644
--- a/sdk/python/openwa/resources/groups.py
+++ b/sdk/python/openwa/resources/groups.py
@@ -18,6 +18,7 @@ from ..types import (
InviteCodeResponse,
JoinGroupRequest,
JoinGroupResponse,
+ ParticipantsResult,
SuccessResult,
)
@@ -43,25 +44,25 @@ class GroupsResource:
def create(self, session_id: str, body: CreateGroupRequest) -> GroupInfo:
return self._http.request("POST", f"/api/sessions/{quote_segment(session_id)}/groups", body=body)
- def add_participants(self, session_id: str, group_id: str, participants: list[str]) -> SuccessResult:
+ def add_participants(self, session_id: str, group_id: str, participants: list[str]) -> ParticipantsResult:
return self._http.request(
"POST", f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}/participants",
body={"participants": participants},
)
- def remove_participants(self, session_id: str, group_id: str, participants: list[str]) -> SuccessResult:
+ def remove_participants(self, session_id: str, group_id: str, participants: list[str]) -> ParticipantsResult:
return self._http.request(
"DELETE", f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}/participants",
body={"participants": participants},
)
- def promote_participants(self, session_id: str, group_id: str, participants: list[str]) -> SuccessResult:
+ def promote_participants(self, session_id: str, group_id: str, participants: list[str]) -> ParticipantsResult:
return self._http.request(
"POST", f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}/participants/promote",
body={"participants": participants},
)
- def demote_participants(self, session_id: str, group_id: str, participants: list[str]) -> SuccessResult:
+ def demote_participants(self, session_id: str, group_id: str, participants: list[str]) -> ParticipantsResult:
return self._http.request(
"POST", f"/api/sessions/{quote_segment(session_id)}/groups/{quote_segment(group_id)}/participants/demote",
body={"participants": participants},
diff --git a/sdk/python/openwa/types.py b/sdk/python/openwa/types.py
index aff044757..726c54cf3 100644
--- a/sdk/python/openwa/types.py
+++ b/sdk/python/openwa/types.py
@@ -42,6 +42,29 @@ class SuccessResult(TypedDict, total=False):
message: str
+class ParticipantResult(TypedDict, total=False):
+ """One entry per requested participant, in the order they were requested.
+
+ ``success`` is true only when the engine confirmed the change for this participant. Engines that
+ confirm the batch rather than each member report one success entry per requested id, so a true
+ here does not always mean the engine spoke about that participant individually.
+ """
+
+ id: str
+ success: bool
+ status: int
+
+
+class ParticipantsResult(SuccessResult):
+ """The group membership writes.
+
+ A partial refusal does NOT fail the batch — the request answers 200 and reports the
+ per-participant outcome in ``results``, so ``success`` alone hides a member that was rejected.
+ """
+
+ results: list[ParticipantResult]
+
+
class ParticipantPresence(TypedDict, total=False):
"""One participant's presence within a chat."""
@@ -489,12 +512,19 @@ class BatchStatusResponse(TypedDict, total=False):
class ContactRecord(TypedDict, total=False):
+ """A contact as the gateway returns it.
+
+ ``isBlocked`` is best-effort: the Baileys adapter does not track blocklist state and always
+ reports ``False``.
+ """
+
id: Jid
name: str | None
number: str | None
- pushname: str | None
- isBusiness: bool
+ pushName: str | None
isMyContact: bool
+ isBlocked: bool
+ profilePicUrl: str | None
class CheckNumberResponse(TypedDict):
@@ -989,6 +1019,16 @@ class PaginatedProducts(TypedDict):
# chatId + productId required; body optional. Modeled total=False for 3.9 compat
# (callers pass plain dicts); the backend validates the required fields.
+class ProductMessageResponse(TypedDict):
+ """Response of ``send-product``.
+
+ The route answers with the sent message's id under ``id``, not the ``messageId`` the other send
+ routes use.
+ """
+
+ id: str
+
+
class SendProductRequest(TypedDict, total=False):
chatId: Jid
productId: str