Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

feat(sdk): mirror chat/message kind field across typed SDKs

Yudhi Armyndharis5dabb588b632
diff --git a/sdk/go/types_chat.go b/sdk/go/types_chat.go
index 08a8095c3..e8a37bc2f 100644
--- a/sdk/go/types_chat.go
+++ b/sdk/go/types_chat.go
@@ -10,6 +10,7 @@ type ChatSummary struct {
UnreadCount int `json:"unreadCount"`
LastMessage string `json:"lastMessage,omitempty"`
Timestamp any `json:"timestamp,omitempty"`
+ Kind string `json:"kind"`
}
// MarkChatRequest marks a chat read/unread.
diff --git a/sdk/go/types_message.go b/sdk/go/types_message.go
index a84562c26..bf6ed5566 100644
--- a/sdk/go/types_message.go
+++ b/sdk/go/types_message.go
@@ -191,6 +191,7 @@ type ChatHistoryMessage struct {
FromMe bool `json:"fromMe"`
IsGroup bool `json:"isGroup"`
IsStatusBroadcast bool `json:"isStatusBroadcast"`
+ Kind string `json:"kind"`
Author string `json:"author,omitempty"`
MentionedIDs []string `json:"mentionedIds,omitempty"`
IsLidSender bool `json:"isLidSender,omitempty"`
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatHistoryMessage.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatHistoryMessage.java
index a1d15b94c..8d63ee63a 100644
--- a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatHistoryMessage.java
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatHistoryMessage.java
@@ -19,6 +19,7 @@ public record ChatHistoryMessage(
boolean fromMe,
boolean isGroup,
Boolean isStatusBroadcast,
+ String kind,
/** For group messages, the participant who sent it ({@code from} is the group JID). */
String author,
List<String> mentionedIds,
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatSummary.java b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatSummary.java
index 53bb6cd86..c2aec5b94 100644
--- a/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatSummary.java
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/model/ChatSummary.java
@@ -13,4 +13,5 @@ public record ChatSummary(
Integer unreadCount,
/** Preview text of the last message (the server returns a plain string, not an object). */
String lastMessage,
- Object timestamp) {}
+ Object timestamp,
+ String kind) {}
diff --git a/sdk/javascript/src/types.ts b/sdk/javascript/src/types.ts
index e65cdbf89..eb0735e85 100644
--- a/sdk/javascript/src/types.ts
+++ b/sdk/javascript/src/types.ts
@@ -16,6 +16,9 @@
/** A WhatsApp JID, e.g. `[email protected]` (user) or `120363…@g.us` (group). */
export type Jid = string;
+/** Chat/message kind discriminator. */
+export type ChatKind = 'individual' | 'group' | 'channel' | 'status' | 'broadcast' | 'unknown';
+
/** Session lifecycle status. */
export type SessionStatus =
'created' | 'initializing' | 'qr_ready' | 'authenticating' | 'ready' | 'disconnected' | 'failed';
@@ -230,6 +233,7 @@ export interface ChatHistoryMessage {
fromMe: boolean;
isGroup: boolean;
isStatusBroadcast?: boolean;
+ kind?: ChatKind;
/** For group messages, the participant who sent it (`from` is the group JID). */
author?: Jid;
mentionedIds?: Jid[];
@@ -548,6 +552,7 @@ export interface ChatSummary {
/** Preview text of the last message (the server returns a plain string, not an object). */
lastMessage?: string;
timestamp?: string | number;
+ kind: ChatKind;
}
export interface MarkChatRequest {
diff --git a/sdk/python/openwa/types.py b/sdk/python/openwa/types.py
index 9a93f809d..3d8f4268a 100644
--- a/sdk/python/openwa/types.py
+++ b/sdk/python/openwa/types.py
@@ -251,6 +251,7 @@ ChatHistoryMessage = TypedDict(
"fromMe": bool,
"isGroup": bool,
"isStatusBroadcast": bool,
+ "kind": str,
"author": Jid,
"mentionedIds": list,
"isLidSender": bool,
@@ -534,6 +535,7 @@ class ChatSummary(TypedDict, total=False):
# Server returns a plain preview string, not a message object.
lastMessage: str
timestamp: str | int
+ kind: str
class MarkChatRequest(TypedDict):