Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(api): make the group-picture 400 and 404 descriptions disjoint

Yudhi Armyndharis463661ce5416
diff --git a/openapi.json b/openapi.json
index 1a756ed65..c858e3022 100644
--- a/openapi.json
+++ b/openapi.json
@@ -5569,13 +5569,13 @@
}
},
"400": {
- "description": "Session not active, or neither url nor base64 supplied"
+ "description": "The id does not name a group, or the session is not active, or neither url nor base64 was supplied"
},
"403": {
"description": "The engine refused the change — admin rights required"
},
"404": {
- "description": "No such group — the id is unknown, or it addresses a 1:1 chat rather than a group."
+ "description": "No such group — the id is unknown."
},
"409": {
"description": "The session is not connected — an engine exists for it but is not `ready`: disconnected, reconnecting, or still initializing, so the request never reached WhatsApp. Wait for `ready` and retry. A session that was never started answers `400` instead, and the session lifecycle routes answer `409` for a conflicting state rather than this. One window answers this while the session still reads `ready`: WhatsApp Web periodically reloads its own page and the engine re-injects into it — for those few seconds the answer is a `409` naming the reload; retry shortly."
@@ -5629,7 +5629,7 @@
"description": "The engine refused the change — admin rights required"
},
"404": {
- "description": "No such group — the id is unknown, or it addresses a 1:1 chat rather than a group."
+ "description": "No such group — the id is unknown."
},
"409": {
"description": "The session is not connected — an engine exists for it but is not `ready`: disconnected, reconnecting, or still initializing, so the request never reached WhatsApp. Wait for `ready` and retry. A session that was never started answers `400` instead, and the session lifecycle routes answer `409` for a conflicting state rather than this. One window answers this while the session still reads `ready`: WhatsApp Web periodically reloads its own page and the engine re-injects into it — for those few seconds the answer is a `409` naming the reload; retry shortly."
diff --git a/src/common/openapi/engine-status-responses.ts b/src/common/openapi/engine-status-responses.ts
index 57ede0b1c..4e930344f 100644
--- a/src/common/openapi/engine-status-responses.ts
+++ b/src/common/openapi/engine-status-responses.ts
@@ -74,8 +74,15 @@ export const CUSTOM_LINK_PREVIEW_501 =
'A caller-supplied `customLinkPreview` is not supported by the whatsapp-web.js engine — only ' +
'Baileys can attach one. The send itself is supported on both; omit the field, or use `linkPreview`.';
-/** `GroupNotFoundError` (404) — unknown id, or an id that addresses a 1:1 chat. */
-export const GROUP_NOT_FOUND_404 = 'No such group — the id is unknown, or it addresses a 1:1 chat rather than a group.';
+/**
+ * `GroupNotFoundError` (404) — the id names a group, but no such group is known.
+ *
+ * It does NOT cover an id that addresses a 1:1 chat: every route carrying this response guards the
+ * id shape first and answers 400, so advertising the 1:1 case here would contradict the 400 on the
+ * same route. Keep the two descriptions disjoint — a caller uses them to tell "wrong kind of id"
+ * (fix the request) apart from "right kind, no such group" (the group is gone or was never joined).
+ */
+export const GROUP_NOT_FOUND_404 = 'No such group — the id is unknown.';
/** `LabelNotFoundError` (404) — never created, or the account is not a Business one. */
export const LABEL_NOT_FOUND_404 =
diff --git a/src/modules/group/group.controller.ts b/src/modules/group/group.controller.ts
index f02873509..c16918726 100644
--- a/src/modules/group/group.controller.ts
+++ b/src/modules/group/group.controller.ts
@@ -464,7 +464,10 @@ export class GroupController {
@ApiParam({ name: 'sessionId', description: 'Session ID' })
@ApiParam({ name: 'groupId', description: 'Group ID' })
@ApiResponse({ status: 200, description: 'Group picture updated', type: GroupAckResponseDto })
- @ApiResponse({ status: 400, description: 'Session not active, or neither url nor base64 supplied' })
+ @ApiResponse({
+ status: 400,
+ description: 'The id does not name a group, or the session is not active, or neither url nor base64 was supplied',
+ })
@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights required' })
@ApiResponse({
status: 503,