Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(call): declare the Baileys 503 on the call-link route

Yudhi Armyndharisc032a6b62aca
diff --git a/src/modules/call/call.controller.spec.ts b/src/modules/call/call.controller.spec.ts
index ccce04b12..bb9aa9418 100644
--- a/src/modules/call/call.controller.spec.ts
+++ b/src/modules/call/call.controller.spec.ts
@@ -31,6 +31,16 @@ describe('CallController', () => {
);
});
+ // Baileys answers an unconfirmed link_create with EngineTransportError (503). The mint is not
+ // idempotent, so the contract must say a 503 can follow a link that was in fact created.
+ it('POST link declares the Baileys 503', () => {
+ const responses = (Reflect.getMetadata(
+ 'swagger/apiResponse',
+ Object.getOwnPropertyDescriptor(CallController.prototype, 'createLink')?.value as object,
+ ) ?? {}) as Record<string, unknown>;
+ expect(Object.keys(responses)).toContain('503');
+ });
+
it('POST :callId/reject returns the success envelope', async () => {
const { controller, service } = build({ rejectCall: jest.fn().mockResolvedValue(undefined) });
await expect(controller.reject('s1', 'CALL1')).resolves.toEqual({ success: true });
diff --git a/src/modules/call/call.controller.ts b/src/modules/call/call.controller.ts
index e3050e995..a5aa2ae0c 100644
--- a/src/modules/call/call.controller.ts
+++ b/src/modules/call/call.controller.ts
@@ -21,6 +21,12 @@ export class CallController {
@ApiResponse({ status: 200, description: 'The generated link', type: CallLinkResponseDto })
@ApiResponse({ status: 400, description: 'Session is not started, or an invalid type / startTime' })
@ApiResponse({ status: 403, description: 'WhatsApp generated no link for this request' })
+ @ApiResponse({
+ status: 503,
+ description:
+ 'Baileys only: WhatsApp did not answer within the request budget. A link may or may not have been ' +
+ 'minted, so a retry can create a second one.',
+ })
@ApiResponse({ status: 409, description: ENGINE_NOT_READY_409 })
async createLink(
@Param('sessionId') sessionId: string,