Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(sdk): warn that chat clear and delete purge the stored history

Yudhi Armyndharisea77305ed9a0
diff --git a/sdk/go/chats.go b/sdk/go/chats.go
index f12d8cd87..1941dad14 100644
--- a/sdk/go/chats.go
+++ b/sdk/go/chats.go
@@ -53,7 +53,9 @@ func (s *ChatsService) MarkUnread(ctx context.Context, sessionID string, body Ma
return s.post(ctx, sessionID, "/unread", body)
}
-// Delete deletes a chat.
+// Delete deletes a chat. On success the gateway also deletes its stored copy of
+// the chat's messages (rows, inline and archived media, search entries); export
+// the history first if you need it.
func (s *ChatsService) Delete(ctx context.Context, sessionID string, body DeleteChatRequest) (*SuccessResult, error) {
return s.post(ctx, sessionID, "/delete", body)
}
@@ -82,7 +84,9 @@ func (s *ChatsService) Mute(ctx context.Context, sessionID string, body MuteChat
// ClearMessages deletes every message in a chat, keeping the chat itself. A
// false Success means the engine declined — an unknown chat, or on Baileys a
-// chat with no known history.
+// chat with no known history. On success the gateway also deletes its stored
+// copy of the chat's messages (rows, inline and archived media, search
+// entries); export the history first if you need it.
func (s *ChatsService) ClearMessages(ctx context.Context, sessionID, chatID string) (*SuccessResult, error) {
var out SuccessResult
path := s.base(sessionID) + "/" + pathEscape(chatID) + "/messages"
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChatsResource.java b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChatsResource.java
index 36c9157eb..f1eeb3f0e 100644
--- a/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChatsResource.java
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/resources/ChatsResource.java
@@ -85,7 +85,11 @@ public final class ChatsResource {
HttpMethod.POST, "/api/sessions/" + encodeSegment(sessionId) + "/chats/unread", null, body, SuccessResult.class);
}
- /** Delete every message in a chat, keeping the chat itself. */
+ /**
+ * Delete every message in a chat, keeping the chat itself. On success the gateway also deletes
+ * its stored copy of the chat's messages (rows, inline and archived media, search entries);
+ * export the history first if you need it.
+ */
public SuccessResult clearMessages(String sessionId, String chatId) {
return client.request(
HttpMethod.DELETE,
@@ -125,7 +129,11 @@ public final class ChatsResource {
HttpMethod.POST, "/api/sessions/" + encodeSegment(sessionId) + "/chats/mute", null, body, SuccessResult.class);
}
- /** Delete a chat from the chat list. */
+ /**
+ * Delete a chat from the chat list. On success the gateway also deletes its stored copy of the
+ * chat's messages (rows, inline and archived media, search entries); export the history first if
+ * you need it.
+ */
public SuccessResult delete(String sessionId, DeleteChatRequest body) {
return client.request(
HttpMethod.POST, "/api/sessions/" + encodeSegment(sessionId) + "/chats/delete", null, body, SuccessResult.class);
diff --git a/sdk/php/src/Resources/ChatsResource.php b/sdk/php/src/Resources/ChatsResource.php
index 7a9b247f0..70cd50a9c 100644
--- a/sdk/php/src/Resources/ChatsResource.php
+++ b/sdk/php/src/Resources/ChatsResource.php
@@ -71,7 +71,9 @@ class ChatsResource
}
/**
- * Delete every message in a chat, keeping the chat itself.
+ * Delete every message in a chat, keeping the chat itself. On success the gateway
+ * also deletes its stored copy of the chat's messages (rows, inline and archived
+ * media, search entries); export the history first if you need it.
*
* @return array<string,mixed>
*/
@@ -121,7 +123,13 @@ class ChatsResource
return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/chats/mute", [], $body) ?? [];
}
- /** @return array<string,mixed> */
+ /**
+ * Delete a chat from the chat list. On success the gateway also deletes its stored
+ * copy of the chat's messages (rows, inline and archived media, search entries);
+ * export the history first if you need it.
+ *
+ * @return array<string,mixed>
+ */
public function delete(string $sessionId, array $body): array
{
return $this->http->request('POST', "/api/sessions/{$this->http->encodeSegment($sessionId)}/chats/delete", [], $body);
diff --git a/sdk/python/openwa/resources/chats.py b/sdk/python/openwa/resources/chats.py
index bfa131a18..6e6bb0516 100644
--- a/sdk/python/openwa/resources/chats.py
+++ b/sdk/python/openwa/resources/chats.py
@@ -88,12 +88,21 @@ class ChatsResource:
return self._http.request("POST", f"/api/sessions/{quote_segment(session_id)}/chats/mute", body=body)
def clear_messages(self, session_id: str, chat_id: str) -> SuccessResult:
- """Delete every message in a chat, keeping the chat. success=False means the engine declined."""
+ """Delete every message in a chat, keeping the chat. success=False means the engine declined.
+
+ On success the gateway also deletes its stored copy of the chat's messages (rows, inline and
+ archived media, search entries); export the history first if you need it.
+ """
return self._http.request(
"DELETE", f"/api/sessions/{quote_segment(session_id)}/chats/{quote_segment(chat_id)}/messages"
)
def delete(self, session_id: str, body: DeleteChatRequest) -> SuccessResult:
+ """Delete a chat from the chat list.
+
+ On success the gateway also deletes its stored copy of the chat's messages (rows, inline and
+ archived media, search entries); export the history first if you need it.
+ """
return self._http.request("POST", f"/api/sessions/{quote_segment(session_id)}/chats/delete", body=body)
def send_state(self, session_id: str, body: SendChatStateRequest) -> SuccessResult: