Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(openapi): document the 503 every budgeted route can answer, and three 501s

Yudhi Armyndharisca3260325ed4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de59203c4..43241a4cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- **Twenty-eight routes now document the `503` they gained in this release, and three document the `501` they always answer on one engine** — every route that reaches an engine call with a request budget can time out, but only ten said so, so a client generated from the contract had no branch for it on the rest and would have reported a gateway fault as an unexpected error; the channel list and channel-message reads refuse on Baileys and subscribe-by-invite refuses on whatsapp-web.js, none of which was stated. The batch avatar lookup's description also said three concurrent engine lookups where the code runs five.
- **Every remaining module now publishes the shape of what it returns** — health, profile, statistics, media, settings, audit, calls, metrics and search were the last nine with no response schema anywhere, so three quarters of the API had nothing for the contract gate to diff; `/api/metrics` is now typed as the Prometheus text it serves rather than implying JSON, and `PUT /api/settings` keeps no success schema because it always answers 501 by design.
- **The labels, channels and status endpoints now publish the shape of what they return** — all twenty-four carried a status and a sentence but no schema, so the committed OpenAPI snapshot had nothing to diff for three whole modules; the status media route is now typed as the binary stream it is rather than implying JSON, and a status timestamp is documented as the ISO-8601 string it serialises to rather than the `Date` the engine hands over.
- **The catalog endpoints now publish the shape of what they return, including one that disagrees with the rest of the API** — `POST /messages/send-product` answers `{id, timestamp}` while every send served by the message module answers `{messageId, timestamp}` for the same value, because this route passes the engine result through unmapped; the schema records the field the code actually sends rather than the one the neighbouring routes use. `send-catalog` is left with no success schema on purpose: no engine can send a catalog link, so a 2xx there would document a response that cannot occur.
diff --git a/openapi.json b/openapi.json
index c12e050f9..4c10843f5 100644
--- a/openapi.json
+++ b/openapi.json
@@ -956,6 +956,9 @@
},
"404": {
"description": "Session not found"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Mark a chat as read/seen",
@@ -1087,6 +1090,9 @@
},
"404": {
"description": "Session not found"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Mark a chat as unread",
@@ -1127,6 +1133,9 @@
},
"404": {
"description": "Session not found"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Delete every message in a chat, keeping the chat itself",
@@ -1168,6 +1177,9 @@
},
"404": {
"description": "Session not found"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Archive or unarchive a chat",
@@ -1209,6 +1221,9 @@
},
"404": {
"description": "Session not found"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Delete a chat from the chat list (e.g. a group you have left)",
@@ -2674,6 +2689,9 @@
},
"400": {
"description": "Session not active or message not found"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Delete a message",
@@ -2847,6 +2865,9 @@
},
"404": {
"description": "Message not found in the chat"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Star or unstar a message",
@@ -3772,7 +3793,7 @@
},
"/api/sessions/{sessionId}/contacts/profile-pictures": {
"get": {
- "description": "One request for a whole chat sidebar — avoids the burst of parallel single fetches that would exhaust the per-IP throttle. Engine lookups run 3 at a time; per-id failures return null.",
+ "description": "One request for a whole chat sidebar — avoids the burst of parallel single fetches that would exhaust the per-IP throttle. Engine lookups run 5 at a time; per-id failures return null.",
"operationId": "ContactController_getProfilePictures",
"parameters": [
{
@@ -3900,6 +3921,9 @@
},
"400": {
"description": "Session not active or invalid request"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Save a contact to the account's addressbook, or edit an existing entry",
@@ -3942,6 +3966,9 @@
},
"400": {
"description": "Session not active"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Remove a contact from the account's addressbook",
@@ -4113,6 +4140,9 @@
}
}
}
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Block a contact",
@@ -4152,6 +4182,9 @@
}
}
}
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Unblock a contact",
@@ -4295,6 +4328,9 @@
},
"400": {
"description": "Invalid or expired invite code, or session is not started"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Join a group via invite code",
@@ -4339,6 +4375,9 @@
},
"404": {
"description": "Group not found"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget — nothing could be read."
}
},
"summary": "Get group settings (announce / locked / ephemeral timer)",
@@ -4400,6 +4439,9 @@
},
"501": {
"description": "The active engine does not support a requested setting"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Update group settings (announce / locked / ephemeral timer)",
@@ -4698,6 +4740,9 @@
},
"403": {
"description": "The engine refused the change — admin rights are required"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Change group name/subject",
@@ -4752,6 +4797,9 @@
},
"403": {
"description": "The engine refused the change — admin rights are required"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Change group description",
@@ -4793,6 +4841,9 @@
}
}
}
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Leave a group",
@@ -4834,6 +4885,9 @@
}
}
}
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget — nothing could be read."
}
},
"summary": "Get the group's picture URL",
@@ -4889,6 +4943,9 @@
},
"403": {
"description": "The engine refused the change — admin rights required"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Set the group's picture",
@@ -4931,6 +4988,9 @@
},
"403": {
"description": "The engine refused the change — admin rights required"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Remove the group's picture",
@@ -5073,6 +5133,9 @@
},
"403": {
"description": "The engine refused the name change"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Set the account display name",
@@ -5118,6 +5181,9 @@
},
"400": {
"description": "Session is not started"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Set the account about/status text",
@@ -5169,6 +5235,9 @@
},
"413": {
"description": "Decoded base64 image exceeds the configured media cap"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Set the account profile picture (URL or base64 image)",
@@ -5216,6 +5285,9 @@
},
"404": {
"description": "Call not found or no longer ringing"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Reject a ringing incoming call",
@@ -5357,6 +5429,9 @@
},
"501": {
"description": "The active engine cannot edit labels (whatsapp-web.js)"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Create or update a label",
@@ -5403,6 +5478,9 @@
},
"501": {
"description": "The active engine cannot edit labels (whatsapp-web.js)"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Delete a label",
@@ -5559,6 +5637,9 @@
},
"422": {
"description": "Labels require a WhatsApp Business account, or the chat type has no labels"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Add a label to a chat",
@@ -5612,6 +5693,9 @@
},
"422": {
"description": "Labels require a WhatsApp Business account, or the chat type has no labels"
+ },
+ "503": {
+ "description": "WhatsApp did not answer within the request budget. The change may or may not have been applied — the gateway stopped waiting for a confirmation that never came."
}
},
"summary": "Remove a label from a chat",
@@ -5650,6 +5734,9 @@
},
"400": {
"description": "Session not ready"
+ },
+ "501": {
+ "description": "Not supported by the active engine: the Baileys adapter cannot list subscribed channels."
}
},
"summary": "Get all subscribed channels/newsletters",
@@ -5839,6 +5926,9 @@
}
}
}
+ },
+ "501": {
+ "description": "Not supported by the active engine: the Baileys adapter cannot read channel messages."
}
},
"summary": "Get messages from a channel",
@@ -6004,6 +6094,9 @@
}
}
},
+ "501": {
+ "description": "Not supported by the active engine: whatsapp-web.js cannot subscribe by invite code."
+ },
"503": {
"description": "WhatsApp did not answer within the request budget — the operation may or may not have applied."
}
diff --git a/src/modules/call/call.controller.ts b/src/modules/call/call.controller.ts
index 8148f7f94..e6031454f 100644
--- a/src/modules/call/call.controller.ts
+++ b/src/modules/call/call.controller.ts
@@ -19,6 +19,12 @@ export class CallController {
@ApiResponse({ status: 200, description: 'Call rejected', type: CallAckResponseDto })
@ApiResponse({ status: 400, description: 'Session is not started' })
@ApiResponse({ status: 404, description: 'Call not found or no longer ringing' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async reject(@Param('sessionId') sessionId: string, @Param('callId') callId: string) {
await this.callService.rejectCall(sessionId, callId);
return { success: true };
diff --git a/src/modules/channel/channel.controller.ts b/src/modules/channel/channel.controller.ts
index 49ec518cf..360633de9 100644
--- a/src/modules/channel/channel.controller.ts
+++ b/src/modules/channel/channel.controller.ts
@@ -18,6 +18,10 @@ export class ChannelController {
@ApiParam({ name: 'sessionId', description: 'Session ID' })
@ApiResponse({ status: 200, description: 'List of subscribed channels', type: [ChannelDto] })
@ApiResponse({ status: 400, description: 'Session not ready' })
+ @ApiResponse({
+ status: 501,
+ description: 'Not supported by the active engine: the Baileys adapter cannot list subscribed channels.',
+ })
async findAll(@Param('sessionId') sessionId: string) {
return this.channelService.getSubscribedChannels(sessionId);
}
@@ -47,6 +51,10 @@ export class ChannelController {
description: 'Max messages to return (default 50, max 100)',
})
@ApiResponse({ status: 200, description: 'List of channel messages', type: [ChannelMessageDto] })
+ @ApiResponse({
+ status: 501,
+ description: 'Not supported by the active engine: the Baileys adapter cannot read channel messages.',
+ })
async getMessages(
@Param('sessionId') sessionId: string,
@Param('channelId') channelId: string,
@@ -151,6 +159,10 @@ export class ChannelController {
status: 503,
description: 'WhatsApp did not answer within the request budget — the operation may or may not have applied.',
})
+ @ApiResponse({
+ status: 501,
+ description: 'Not supported by the active engine: whatsapp-web.js cannot subscribe by invite code.',
+ })
async subscribe(@Param('sessionId') sessionId: string, @Body() body: SubscribeChannelDto) {
return this.channelService.subscribeToChannel(sessionId, body.inviteCode);
}
diff --git a/src/modules/contact/contact.controller.ts b/src/modules/contact/contact.controller.ts
index b27989b57..598ea0f63 100644
--- a/src/modules/contact/contact.controller.ts
+++ b/src/modules/contact/contact.controller.ts
@@ -46,7 +46,7 @@ export class ContactController {
summary: 'Batch-resolve profile picture URLs for up to 50 contacts',
description:
'One request for a whole chat sidebar — avoids the burst of parallel single fetches that ' +
- 'would exhaust the per-IP throttle. Engine lookups run 3 at a time; per-id failures return null.',
+ 'would exhaust the per-IP throttle. Engine lookups run 5 at a time; per-id failures return null.',
})
@ApiParam({ name: 'sessionId', description: 'Session ID' })
@ApiQuery({ name: 'ids', required: true, description: 'Comma-separated contact ids (max 50 used)' })
@@ -153,6 +153,12 @@ export class ContactController {
@ApiParam({ name: 'contactId', description: 'Contact ID (e.g., [email protected])' })
@ApiResponse({ status: 200, description: 'Contact saved', type: ContactAckResponseDto })
@ApiResponse({ status: 400, description: 'Session not active or invalid request' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async upsertContact(
@Param('sessionId') sessionId: string,
@Param('contactId') contactId: string,
@@ -171,6 +177,12 @@ export class ContactController {
@ApiParam({ name: 'contactId', description: 'Contact ID (e.g., [email protected])' })
@ApiResponse({ status: 200, description: 'Contact deleted', type: ContactAckResponseDto })
@ApiResponse({ status: 400, description: 'Session not active' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async deleteContact(@Param('sessionId') sessionId: string, @Param('contactId') contactId: string) {
await this.contactService.deleteContact(sessionId, contactId);
return { success: true, message: 'Contact deleted' };
@@ -187,6 +199,12 @@ export class ContactController {
description: 'Contact blocked',
type: ContactAckResponseDto,
})
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async blockContact(@Param('sessionId') sessionId: string, @Param('contactId') contactId: string) {
await this.contactService.blockContact(sessionId, contactId);
return { success: true, message: 'Contact blocked' };
@@ -202,6 +220,12 @@ export class ContactController {
description: 'Contact unblocked',
type: ContactAckResponseDto,
})
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async unblockContact(@Param('sessionId') sessionId: string, @Param('contactId') contactId: string) {
await this.contactService.unblockContact(sessionId, contactId);
return { success: true, message: 'Contact unblocked' };
diff --git a/src/modules/group/group.controller.ts b/src/modules/group/group.controller.ts
index 113824464..6a975530e 100644
--- a/src/modules/group/group.controller.ts
+++ b/src/modules/group/group.controller.ts
@@ -90,6 +90,12 @@ export class GroupController {
@ApiBody({ type: JoinGroupDto })
@ApiResponse({ status: 200, description: 'Joined the group', type: GroupJoinedResponseDto })
@ApiResponse({ status: 400, description: 'Invalid or expired invite code, or session is not started' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async join(@Param('sessionId') sessionId: string, @Body() dto: JoinGroupDto) {
const groupId = await this.groupService.joinGroupViaInviteCode(sessionId, dto.inviteCode);
return { success: true, groupId };
@@ -101,6 +107,10 @@ export class GroupController {
@ApiParam({ name: 'groupId', description: 'Group ID' })
@ApiResponse({ status: 200, description: 'Group settings', type: GroupSettingsResponseDto })
@ApiResponse({ status: 404, description: 'Group not found' })
+ @ApiResponse({
+ status: 503,
+ description: 'WhatsApp did not answer within the request budget — nothing could be read.',
+ })
async getSettings(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {
return this.groupService.getGroupSettings(sessionId, groupId);
}
@@ -116,6 +126,12 @@ export class GroupController {
@ApiResponse({ status: 403, description: 'The engine refused the change (the account is not a group admin)' })
@ApiResponse({ status: 404, description: 'Group not found' })
@ApiResponse({ status: 501, description: 'The active engine does not support a requested setting' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async updateSettings(
@Param('sessionId') sessionId: string,
@Param('groupId') groupId: string,
@@ -230,6 +246,12 @@ export class GroupController {
@ApiBody({ type: GroupSubjectDto })
@ApiResponse({ status: 200, description: 'Subject updated', type: GroupAckResponseDto })
@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights are required' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async setSubject(
@Param('sessionId') sessionId: string,
@Param('groupId') groupId: string,
@@ -247,6 +269,12 @@ export class GroupController {
@ApiBody({ type: GroupDescriptionDto })
@ApiResponse({ status: 200, description: 'Description updated', type: GroupAckResponseDto })
@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights are required' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async setDescription(
@Param('sessionId') sessionId: string,
@Param('groupId') groupId: string,
@@ -263,6 +291,12 @@ export class GroupController {
@ApiParam({ name: 'groupId', description: 'Group ID' })
@ApiResponse({ status: 200, description: 'Left the group', type: GroupAckResponseDto })
@HttpCode(HttpStatus.OK)
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async leave(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {
await this.groupService.leaveGroup(sessionId, groupId);
return { success: true, message: 'Left the group' };
@@ -279,6 +313,10 @@ export class GroupController {
description: 'Picture URL, or null when the group has none',
type: GroupPictureResponseDto,
})
+ @ApiResponse({
+ status: 503,
+ description: 'WhatsApp did not answer within the request budget — nothing could be read.',
+ })
async getPicture(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {
return { url: await this.groupService.getGroupPicture(sessionId, groupId) };
}
@@ -292,6 +330,12 @@ export class GroupController {
@ApiResponse({ status: 200, description: 'Group picture updated', type: GroupAckResponseDto })
@ApiResponse({ status: 400, description: 'Session not active, or neither url nor base64 supplied' })
@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights required' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async setPicture(
@Param('sessionId') sessionId: string,
@Param('groupId') groupId: string,
@@ -309,6 +353,12 @@ export class GroupController {
@ApiParam({ name: 'groupId', description: 'Group ID' })
@ApiResponse({ status: 200, description: 'Group picture removed', type: GroupAckResponseDto })
@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights required' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async deletePicture(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {
await this.groupService.deleteGroupPicture(sessionId, groupId);
return { success: true, message: 'Group picture removed' };
diff --git a/src/modules/label/label.controller.ts b/src/modules/label/label.controller.ts
index e9efc7cb0..ac53eeb96 100644
--- a/src/modules/label/label.controller.ts
+++ b/src/modules/label/label.controller.ts
@@ -66,6 +66,12 @@ export class LabelController {
@ApiResponse({ status: 200, description: 'Label created or updated', type: LabelAckResponseDto })
@ApiResponse({ status: 400, description: 'Session not started, or validation failed' })
@ApiResponse({ status: 501, description: 'The active engine cannot edit labels (whatsapp-web.js)' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async upsertLabel(
@Param('sessionId') sessionId: string,
@Param('labelId') labelId: string,
@@ -89,6 +95,12 @@ export class LabelController {
@ApiResponse({ status: 200, description: 'Label deleted', type: LabelAckResponseDto })
@ApiResponse({ status: 400, description: 'Session not started' })
@ApiResponse({ status: 501, description: 'The active engine cannot edit labels (whatsapp-web.js)' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async deleteLabel(
@Param('sessionId') sessionId: string,
@Param('labelId') labelId: string,
@@ -126,6 +138,12 @@ export class LabelController {
status: 422,
description: 'Labels require a WhatsApp Business account, or the chat type has no labels',
})
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async addLabelToChat(
@Param('sessionId') sessionId: string,
@Param('chatId') chatId: string,
@@ -146,6 +164,12 @@ export class LabelController {
status: 422,
description: 'Labels require a WhatsApp Business account, or the chat type has no labels',
})
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async removeLabelFromChat(
@Param('sessionId') sessionId: string,
@Param('chatId') chatId: string,
diff --git a/src/modules/message/message.controller.ts b/src/modules/message/message.controller.ts
index 80d6ece99..2d3e362c3 100644
--- a/src/modules/message/message.controller.ts
+++ b/src/modules/message/message.controller.ts
@@ -422,6 +422,12 @@ export class MessageController {
status: 400,
description: 'Session not active or message not found',
})
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async deleteMessage(
@Param('sessionId') sessionId: string,
@Body() dto: DeleteMessageDto,
@@ -490,6 +496,12 @@ export class MessageController {
})
@ApiResponse({ status: 400, description: 'Session not active' })
@ApiResponse({ status: 404, description: 'Message not found in the chat' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async starMessage(@Param('sessionId') sessionId: string, @Body() dto: StarMessageDto): Promise<{ success: boolean }> {
return this.messageService.starMessage(sessionId, dto);
}
diff --git a/src/modules/profile/profile.controller.ts b/src/modules/profile/profile.controller.ts
index e3f09fc6d..68e91a975 100644
--- a/src/modules/profile/profile.controller.ts
+++ b/src/modules/profile/profile.controller.ts
@@ -19,6 +19,12 @@ export class ProfileController {
@ApiResponse({ status: 200, description: 'Profile name updated', type: ProfileAckResponseDto })
@ApiResponse({ status: 400, description: 'Session is not started' })
@ApiResponse({ status: 403, description: 'The engine refused the name change' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async setName(@Param('sessionId') sessionId: string, @Body() dto: SetProfileNameDto) {
await this.profileService.setProfileName(sessionId, dto.name);
return { success: true, message: 'Profile name updated' };
@@ -31,6 +37,12 @@ export class ProfileController {
@ApiBody({ type: SetProfileStatusDto })
@ApiResponse({ status: 200, description: 'Profile status updated', type: ProfileAckResponseDto })
@ApiResponse({ status: 400, description: 'Session is not started' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async setStatus(@Param('sessionId') sessionId: string, @Body() dto: SetProfileStatusDto) {
await this.profileService.setProfileStatus(sessionId, dto.status);
return { success: true, message: 'Profile status updated' };
@@ -48,6 +60,12 @@ export class ProfileController {
})
@ApiResponse({ status: 403, description: 'The engine refused the picture change' })
@ApiResponse({ status: 413, description: 'Decoded base64 image exceeds the configured media cap' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async setPicture(@Param('sessionId') sessionId: string, @Body() dto: SetProfilePictureDto) {
await this.profileService.setProfilePicture(sessionId, dto);
return { success: true, message: 'Profile picture updated' };
diff --git a/src/modules/session/session.controller.ts b/src/modules/session/session.controller.ts
index 1b836151a..4df443e17 100644
--- a/src/modules/session/session.controller.ts
+++ b/src/modules/session/session.controller.ts
@@ -415,6 +415,12 @@ export class SessionController {
@ApiResponse({ status: 200, description: 'Chat marked as read successfully' })
@ApiResponse({ status: 400, description: 'Session not ready' })
@ApiResponse({ status: 404, description: 'Session not found' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async markChatRead(
@Param('id', ParseUUIDPipe) id: string,
@Body() dto: MarkChatReadDto,
@@ -483,6 +489,12 @@ export class SessionController {
@ApiResponse({ status: 200, description: 'Chat marked as unread successfully' })
@ApiResponse({ status: 400, description: 'Session not ready' })
@ApiResponse({ status: 404, description: 'Session not found' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async markChatUnread(
@Param('id', ParseUUIDPipe) id: string,
@Body() dto: MarkChatReadDto,
@@ -505,6 +517,12 @@ export class SessionController {
})
@ApiResponse({ status: 400, description: 'Session not ready' })
@ApiResponse({ status: 404, description: 'Session not found' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async clearChatMessages(
@Param('id', ParseUUIDPipe) id: string,
@Param('chatId') chatId: string,
@@ -526,6 +544,12 @@ export class SessionController {
})
@ApiResponse({ status: 400, description: 'Session not ready' })
@ApiResponse({ status: 404, description: 'Session not found' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async archiveChat(
@Param('id', ParseUUIDPipe) id: string,
@Body() dto: ArchiveChatDto,
@@ -542,6 +566,12 @@ export class SessionController {
@ApiResponse({ status: 200, description: 'Chat deleted successfully' })
@ApiResponse({ status: 400, description: 'Session not ready' })
@ApiResponse({ status: 404, description: 'Session not found' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'WhatsApp did not answer within the request budget. The change may or may not have been applied — ' +
+ 'the gateway stopped waiting for a confirmation that never came.',
+ })
async deleteChat(@Param('id', ParseUUIDPipe) id: string, @Body() dto: DeleteChatDto): Promise<{ success: boolean }> {
const success = await this.sessionService.deleteChat(id, dto.chatId);
return { success };