Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(contact): describe the number check id as the neutral form

Yudhi Armyndharisfe7079adf5d1
diff --git a/docs/06-api-specification.md b/docs/06-api-specification.md
index 45e7f26db..deb148ae5 100644
--- a/docs/06-api-specification.md
+++ b/docs/06-api-specification.md
@@ -2577,7 +2577,7 @@ Check whether a phone number exists on WhatsApp and return its canonical WhatsAp
}
```
-`whatsappId` is the canonical native chat id, or `null` when the number is not on WhatsApp; `exists` is `whatsappId !== null`.
+`whatsappId` is the chat id WhatsApp holds for the number, in the neutral `<phone>@c.us` form on both engines (it can differ from the digits supplied), or `null` when the number is not on WhatsApp; `exists` is `whatsappId !== null`.
> Route-order caveat: this route is two path segments (`check/:number`), so it never collides with the single-segment `GET /:contactId` — a contact id of literally `check` resolves to `GET /:contactId`.
diff --git a/openapi.json b/openapi.json
index f6e611e18..16a739009 100644
--- a/openapi.json
+++ b/openapi.json
@@ -23308,7 +23308,7 @@
"whatsappId": {
"type": "string",
"nullable": true,
- "description": "The canonical chat id in the engine's native format, or null when the number is not registered.",
+ "description": "The chat id WhatsApp holds for the number, in the neutral `<phone>@c.us` form on both engines (it can differ from the digits supplied), or null when the number is not registered.",
"example": "[email protected]"
}
},
diff --git a/src/modules/contact/contact.controller.ts b/src/modules/contact/contact.controller.ts
index 5ae0df9e9..68d14bb34 100644
--- a/src/modules/contact/contact.controller.ts
+++ b/src/modules/contact/contact.controller.ts
@@ -149,8 +149,8 @@ export class ContactController {
})
@ApiResponse({ status: 409, description: ENGINE_NOT_READY_409 })
async checkNumber(@Param('sessionId') sessionId: string, @Param('number') number: string) {
- // The engine returns the canonical chat id in its native format; we don't build the JID here
- // (decoupled from the whatsapp-web.js `@c.us` scheme).
+ // The engine returns the id already in the neutral `<phone>@c.us` form (the Baileys adapter neutralizes its
+ // own answer, the whatsapp-web.js one folds an `@lid` back to the phone id); we don't build the JID here.
const whatsappId = await this.contactService.getNumberId(sessionId, number);
return {
number,
diff --git a/src/modules/contact/dto/contact-response.dto.ts b/src/modules/contact/dto/contact-response.dto.ts
index 7de0db465..df2aceda1 100644
--- a/src/modules/contact/dto/contact-response.dto.ts
+++ b/src/modules/contact/dto/contact-response.dto.ts
@@ -80,7 +80,9 @@ export class NumberCheckResponseDto {
@ApiProperty({
type: String,
nullable: true,
- description: "The canonical chat id in the engine's native format, or null when the number is not registered.",
+ description:
+ 'The chat id WhatsApp holds for the number, in the neutral `<phone>@c.us` form on both engines ' +
+ '(it can differ from the digits supplied), or null when the number is not registered.',
example: '[email protected]',
})
whatsappId!: string | null;