Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

feat(dashboard): add ChatKind, Channel types and channel API methods

Yudhi Armyndharis7a27463703f5
diff --git a/dashboard/src/services/api.ts b/dashboard/src/services/api.ts
index 13f15c0fe..a32182209 100644
--- a/dashboard/src/services/api.ts
+++ b/dashboard/src/services/api.ts
@@ -132,11 +132,15 @@ export interface MessageResponse {
timestamp: number;
}
+// Mirrors the backend engine ChatKind (dashboard cannot import wa-id.ts).
+export type ChatKind = 'individual' | 'group' | 'channel' | 'status' | 'broadcast' | 'unknown';
+
// Chat summary returned by GET /sessions/:id/chats (mirrors the backend ChatSummary).
export interface Chat {
id: string;
name: string;
isGroup: boolean;
+ kind: ChatKind;
unreadCount: number;
timestamp: number;
lastMessage?: string;
@@ -172,6 +176,8 @@ export interface ChatMessage {
id: string;
waMessageId?: string;
chatId: string;
+ /** Chat kind of the source conversation (present on live engine/WS payloads). */
+ kind?: ChatKind;
from: string;
to: string;
body: string;
@@ -202,6 +208,23 @@ export interface EngineHistoryMessage {
media?: { mimetype: string; filename?: string; data?: string };
}
+// Mirrors the backend engine Channel / ChannelMessage (GET /sessions/:id/channels[/:id/messages]).
+export interface Channel {
+ id: string;
+ name: string;
+ subscriberCount?: number;
+ inviteCode?: string;
+ verified?: boolean;
+}
+
+export interface ChannelMessage {
+ id: string;
+ body: string;
+ timestamp: number;
+ hasMedia: boolean;
+ mediaUrl?: string;
+}
+
export interface SendMediaPayload {
base64?: string;
url?: string;
@@ -583,6 +606,9 @@ export const sessionApi = {
includeMedia ? '&includeMedia=true' : ''
}`,
),
+ getSubscribedChannels: (id: string) => request<Channel[]>(`/sessions/${id}/channels`),
+ getChannelMessages: (id: string, channelId: string, limit = 50) =>
+ request<ChannelMessage[]>(`/sessions/${id}/channels/${encodeURIComponent(channelId)}/messages?limit=${limit}`),
};
// =============================================================================