mv.whatsappNumbers
WhatsApp Business numbers whose calls your organization takes. These methods are on mv.whatsappNumbers, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
create()
Section titled “create()”Connect a WhatsApp number. Connects a WhatsApp Business number for calling: WhatsApp’s IDs of the number and its business account, the number in E.164, where its calls go (assistant_id, flow_id or inbound_route_id), and the access token the platform uses for the number’s calls; optionally the notice the AI speaks first on its calls (disclosure_text), WhatsApp’s callback permission setting and your metadata. The token is write-only: it is stored encrypted and only its last 4 characters and a fingerprint come back. A number belongs to one organization: 409 resource_conflict when it is connected already (here or elsewhere). Needs a live key and WhatsApp calling enabled for the organization. Send an Idempotency-Key so a retry never connects twice.
mv.whatsappNumbers.create(body: WhatsappNumbersCreateData["body"], options?: RequestOptions): Promise<WhatsappNumbersCreateResponse>POST /whatsapp_numbers · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
body.whatsapp_phone_number_id |
string |
yes | WhatsApp’s ID of the business phone number (digits), from the WhatsApp Business Account. |
body.waba_id |
string |
yes | The WhatsApp Business Account that holds the number (digits). |
body.e164 |
string |
yes | The number in E.164. |
body.access_token |
string |
yes | The WhatsApp Business access token the platform uses for this number’s calls. Write-only: stored encrypted and never returned (the number shows its last 4 characters and a fingerprint). |
body.assistant_id |
string |
no | Calls to the number reach this assistant. |
body.callback_permission |
"disabled" | "enabled" |
no | WhatsApp’s callback permission setting of the number (callback_permission_status): enabled when a user who calls the number grants your business a call permission (WhatsApp: 7 days), so a missed call can be called back without a permission request. Set it as the number is set at WhatsApp: the platform doesn’t change WhatsApp’s settings. Business-initiated calls refused for a missing permission say it in details.permission.callback_permission. Default disabled. |
body.disclosure_text |
string | null |
no | The notice the AI speaks first on this number’s calls (that the caller talks to an AI, and that the call is recorded when it is), in place of the default notice. At most 500 characters, spoken as written: include the recording sentence when the calls are recorded. Empty or null: the default notice. |
body.flow_id |
string |
no | Calls to the number run this published flow. |
body.inbound_route_id |
string |
no | Calls to the number follow this inbound route’s target. |
body.label |
string |
no | A name for the number, shown in lists. |
body.metadata |
MetadataInput |
no | Up to 50 key/value pairs (keys up to 40 characters, values up to 500) you attach to an object. Returned as sent. |
body.recording |
"inherit" | "on" | "off" |
no | Default inherit (the target’s setting). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”WhatsAppNumber:
| Field | Type | Description |
|---|---|---|
id |
string |
The WhatsApp number’s ID. |
object |
"whatsapp_number" |
Always whatsapp_number. |
livemode |
boolean |
true in live mode, false in test mode. |
whatsapp_phone_number_id |
string |
WhatsApp’s ID of the business phone number (digits): calls to it come here. One organization per number. |
waba_id |
string |
The WhatsApp Business Account that holds the number (digits). |
e164 |
string |
The number in E.164. |
label |
string |
Your name for the number (may be empty). |
status |
"active" | "disabled" |
active: calls to the number are taken. disabled: they are refused; the number keeps its settings. |
assistant_id |
string | null |
asst_… ID. |
flow_id |
string | null |
flow_… ID. |
inbound_route_id |
string | null |
rte_… ID. |
recording |
"inherit" | "on" | "off" |
inherit: the target’s own recording setting. on / off: this number decides. |
token |
object |
The access token, as far as it shows: never the token itself. |
calling |
object |
The number’s calling settings at WhatsApp. |
disclosure_text |
string | null |
The notice the AI speaks first on this number’s calls (that the caller talks to an AI, and that the call is recorded when it is), in place of the default notice. At most 500 characters, spoken as written: include the recording sentence when the calls are recorded. Empty or null: the default notice. Null: the default notice. |
callback_permission |
"disabled" | "enabled" |
WhatsApp’s callback permission setting of the number (callback_permission_status): enabled when a user who calls the number grants your business a call permission (WhatsApp: 7 days), so a missed call can be called back without a permission request. Set it as the number is set at WhatsApp: the platform doesn’t change WhatsApp’s settings. Business-initiated calls refused for a missing permission say it in details.permission.callback_permission. |
metadata |
Metadata |
Up to 50 key/value pairs (keys up to 40 characters, values up to 500) you attach to an object. Returned as sent. |
disabled_at |
string | null |
When the number was disabled, or null. |
created |
string |
An ISO-8601 timestamp in UTC. |
updated |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const whatsAppNumber = await mv.whatsappNumbers.create({ access_token: "your-whatsapp-business-access-token", assistant_id: "asst_7Kp1Ns4Vy6Ab9Dg2Hj5Lm8", callback_permission: "enabled", e164: "+97235550100", label: "Support line", metadata: { workspace_id: "ws_12", }, waba_id: "102290129340398", whatsapp_phone_number_id: "106540352242922",});console.log(whatsAppNumber);delete()
Section titled “delete()”Remove a WhatsApp number. Removes the number and its stored access token: its calls are no longer taken, and it can be connected again (here or by another organization).
mv.whatsappNumbers.delete(id: WhatsappNumbersDeleteData["path"]["id"], options?: RequestOptions): Promise<WhatsappNumbersDeleteResponse>DELETE /whatsapp_numbers/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A whatsapp number ID (wan_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”DeletedWhatsAppNumber:
| Field | Type | Description |
|---|---|---|
id |
string |
The removed number’s ID. |
object |
"whatsapp_number" |
Always whatsapp_number. |
deleted |
true |
— |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const deletedWhatsAppNumber = await mv.whatsappNumbers.delete("wan_7Hk2Lm9Qp");console.log(deletedWhatsAppNumber);list()
Section titled “list()”List WhatsApp numbers. Your organization’s WhatsApp Business numbers for calling, newest first. Needs a live key and WhatsApp calling enabled for the organization (otherwise 403 feature_unavailable). Access tokens are never returned.
mv.whatsappNumbers.list(query?: NonNullable<WhatsappNumbersListData["query"]>, options?: RequestOptions): PagedList<WhatsappNumbersListResponse["data"][number], NonNullable<WhatsappNumbersListData["query"]>>GET /whatsapp_numbers · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
query.status |
string |
no | Only numbers with this status. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const whatsappNumber of mv.whatsappNumbers.list()) { console.log(whatsappNumber);}retrieve()
Section titled “retrieve()”Retrieve a WhatsApp number. Returns the WhatsAppNumber object. Answers 404 with the code resource_missing when nothing has this ID in this organisation and mode.
mv.whatsappNumbers.retrieve(id: WhatsappNumbersRetrieveData["path"]["id"], options?: RequestOptions): Promise<WhatsappNumbersRetrieveResponse>GET /whatsapp_numbers/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A whatsapp number ID (wan_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”WhatsAppNumber:
| Field | Type | Description |
|---|---|---|
id |
string |
The WhatsApp number’s ID. |
object |
"whatsapp_number" |
Always whatsapp_number. |
livemode |
boolean |
true in live mode, false in test mode. |
whatsapp_phone_number_id |
string |
WhatsApp’s ID of the business phone number (digits): calls to it come here. One organization per number. |
waba_id |
string |
The WhatsApp Business Account that holds the number (digits). |
e164 |
string |
The number in E.164. |
label |
string |
Your name for the number (may be empty). |
status |
"active" | "disabled" |
active: calls to the number are taken. disabled: they are refused; the number keeps its settings. |
assistant_id |
string | null |
asst_… ID. |
flow_id |
string | null |
flow_… ID. |
inbound_route_id |
string | null |
rte_… ID. |
recording |
"inherit" | "on" | "off" |
inherit: the target’s own recording setting. on / off: this number decides. |
token |
object |
The access token, as far as it shows: never the token itself. |
calling |
object |
The number’s calling settings at WhatsApp. |
disclosure_text |
string | null |
The notice the AI speaks first on this number’s calls (that the caller talks to an AI, and that the call is recorded when it is), in place of the default notice. At most 500 characters, spoken as written: include the recording sentence when the calls are recorded. Empty or null: the default notice. Null: the default notice. |
callback_permission |
"disabled" | "enabled" |
WhatsApp’s callback permission setting of the number (callback_permission_status): enabled when a user who calls the number grants your business a call permission (WhatsApp: 7 days), so a missed call can be called back without a permission request. Set it as the number is set at WhatsApp: the platform doesn’t change WhatsApp’s settings. Business-initiated calls refused for a missing permission say it in details.permission.callback_permission. |
metadata |
Metadata |
Up to 50 key/value pairs (keys up to 40 characters, values up to 500) you attach to an object. Returned as sent. |
disabled_at |
string | null |
When the number was disabled, or null. |
created |
string |
An ISO-8601 timestamp in UTC. |
updated |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const whatsAppNumber = await mv.whatsappNumbers.retrieve("wan_7Hk2Lm9Qp");console.log(whatsAppNumber);update()
Section titled “update()”Update a WhatsApp number. Changes the label, where calls go, the recording mode, the spoken notice (disclosure_text), the callback permission setting, the metadata (keys merge; an empty string removes a key) or the status (disabled refuses the number’s calls and keeps its settings), or sets a new access token (rotation: the old one is not kept, and the token status goes back to unverified). Fields you leave out stay as they are.
mv.whatsappNumbers.update(id: WhatsappNumbersUpdateData["path"]["id"], body?: WhatsappNumbersUpdateData["body"], options?: RequestOptions): Promise<WhatsappNumbersUpdateResponse>PATCH /whatsapp_numbers/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A whatsapp number ID (wan_…). |
body.access_token |
string |
no | A new access token (rotation): replaces the stored one, which is not kept. Write-only. |
body.assistant_id |
string | null |
no | asst_… ID. |
body.callback_permission |
"disabled" | "enabled" |
no | WhatsApp’s callback permission setting of the number (callback_permission_status): enabled when a user who calls the number grants your business a call permission (WhatsApp: 7 days), so a missed call can be called back without a permission request. Set it as the number is set at WhatsApp: the platform doesn’t change WhatsApp’s settings. Business-initiated calls refused for a missing permission say it in details.permission.callback_permission. |
body.disclosure_text |
string | null |
no | The notice the AI speaks first on this number’s calls (that the caller talks to an AI, and that the call is recorded when it is), in place of the default notice. At most 500 characters, spoken as written: include the recording sentence when the calls are recorded. Empty or null: the default notice. Send null or an empty string to go back to the default. |
body.flow_id |
string | null |
no | flow_… ID. |
body.inbound_route_id |
string | null |
no | rte_… ID. |
body.label |
string |
no | A name for the number. |
body.metadata |
MetadataInput |
no | Up to 50 key/value pairs (keys up to 40 characters, values up to 500) you attach to an object. Returned as sent. |
body.recording |
"inherit" | "on" | "off" |
no | |
body.status |
"active" | "disabled" |
no | disabled refuses the number’s calls (its settings stay); active takes them again. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”WhatsAppNumber:
| Field | Type | Description |
|---|---|---|
id |
string |
The WhatsApp number’s ID. |
object |
"whatsapp_number" |
Always whatsapp_number. |
livemode |
boolean |
true in live mode, false in test mode. |
whatsapp_phone_number_id |
string |
WhatsApp’s ID of the business phone number (digits): calls to it come here. One organization per number. |
waba_id |
string |
The WhatsApp Business Account that holds the number (digits). |
e164 |
string |
The number in E.164. |
label |
string |
Your name for the number (may be empty). |
status |
"active" | "disabled" |
active: calls to the number are taken. disabled: they are refused; the number keeps its settings. |
assistant_id |
string | null |
asst_… ID. |
flow_id |
string | null |
flow_… ID. |
inbound_route_id |
string | null |
rte_… ID. |
recording |
"inherit" | "on" | "off" |
inherit: the target’s own recording setting. on / off: this number decides. |
token |
object |
The access token, as far as it shows: never the token itself. |
calling |
object |
The number’s calling settings at WhatsApp. |
disclosure_text |
string | null |
The notice the AI speaks first on this number’s calls (that the caller talks to an AI, and that the call is recorded when it is), in place of the default notice. At most 500 characters, spoken as written: include the recording sentence when the calls are recorded. Empty or null: the default notice. Null: the default notice. |
callback_permission |
"disabled" | "enabled" |
WhatsApp’s callback permission setting of the number (callback_permission_status): enabled when a user who calls the number grants your business a call permission (WhatsApp: 7 days), so a missed call can be called back without a permission request. Set it as the number is set at WhatsApp: the platform doesn’t change WhatsApp’s settings. Business-initiated calls refused for a missing permission say it in details.permission.callback_permission. |
metadata |
Metadata |
Up to 50 key/value pairs (keys up to 40 characters, values up to 500) you attach to an object. Returned as sent. |
disabled_at |
string | null |
When the number was disabled, or null. |
created |
string |
An ISO-8601 timestamp in UTC. |
updated |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const whatsAppNumber = await mv.whatsappNumbers.update("wan_7Hk2Lm9Qp", { flow_id: "flow_7Kp1Ns4Vy6Ab9Dg2Hj5Lm8", recording: "on",});console.log(whatsAppNumber);