Skip to content

client.whatsapp_numbers

WhatsApp Business numbers whose calls your organization takes. These methods are on client.whatsapp_numbers, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.

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.

client.whatsapp_numbers
def create(self, body: _m.WhatsAppNumberCreateParamsInput | Mapping[str, Any], *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.WhatsAppNumber

client.whatsapp_numbers.create() · await async_client.whatsapp_numbers.create() · POST /whatsapp_numbers · API reference

Field Type Required Description
whatsapp_phone_number_id string yes WhatsApp’s ID of the business phone number (digits), from the WhatsApp Business Account.
waba_id string yes The WhatsApp Business Account that holds the number (digits).
e164 string yes The number in E.164.
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).
assistant_id string no Calls to the number reach this assistant.
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.
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.
flow_id string no Calls to the number run this published flow.
inbound_route_id string no Calls to the number follow this inbound route’s target.
label string no A name for the number, shown in lists.
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.
recording "inherit" | "on" | "off" no Default inherit (the target’s setting).

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.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
whats_app_number = client.whatsapp_numbers.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",
})
print(whats_app_number)

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).

client.whatsapp_numbers
def delete(self, id: str, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.DeletedWhatsAppNumber

client.whatsapp_numbers.delete() · await async_client.whatsapp_numbers.delete() · DELETE /whatsapp_numbers/{id} · API reference

Name Type Required Description
id str yes A whatsapp number ID (wan_…).

DeletedWhatsAppNumber:

Field Type Description
id string The removed number’s ID.
object "whatsapp_number" Always whatsapp_number.
deleted true —
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
deleted_whats_app_number = client.whatsapp_numbers.delete("wan_7Hk2Lm9Qp")
print(deleted_whats_app_number)

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.

client.whatsapp_numbers
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, status: _m.WhatsappNumbersListStatus | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.WhatsAppNumber]

client.whatsapp_numbers.list() · await async_client.whatsapp_numbers.list() · GET /whatsapp_numbers · API reference

Name Type Required Description
limit integer no How many objects to return, 1–100 (default 20).
starting_after string no A cursor (next_cursor) or object ID: return the objects after it (older).
ending_before string no A cursor or object ID: return the objects before it (newer).
status "active" | "disabled" no Only numbers with this status.

A page of results (WhatsAppNumberList): data, has_more and next_cursor.

from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
for whatsapp_number in client.whatsapp_numbers.list():
print(whatsapp_number)

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.

client.whatsapp_numbers
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.WhatsAppNumber

client.whatsapp_numbers.retrieve() · await async_client.whatsapp_numbers.retrieve() · GET /whatsapp_numbers/{id} · API reference

Name Type Required Description
id str yes A whatsapp number ID (wan_…).

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.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
whats_app_number = client.whatsapp_numbers.retrieve("wan_7Hk2Lm9Qp")
print(whats_app_number)

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.

client.whatsapp_numbers
def update(self, id: str, body: _m.WhatsAppNumberUpdateParamsInput | Mapping[str, Any] | Unset = UNSET, *, more_voice_version: str | Unset = UNSET) -> _m.WhatsAppNumber

client.whatsapp_numbers.update() · await async_client.whatsapp_numbers.update() · PATCH /whatsapp_numbers/{id} · API reference

Name Type Required Description
id str yes A whatsapp number ID (wan_…).
Field Type Required Description
access_token string no A new access token (rotation): replaces the stored one, which is not kept. Write-only.
assistant_id string | null no asst_… ID.
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.
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.
flow_id string | null no flow_… ID.
inbound_route_id string | null no rte_… ID.
label string no A name for the number.
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.
recording "inherit" | "on" | "off" no —
status "active" | "disabled" no disabled refuses the number’s calls (its settings stay); active takes them again.

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.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
whats_app_number = client.whatsapp_numbers.update("wan_7Hk2Lm9Qp", {
"flow_id": "flow_7Kp1Ns4Vy6Ab9Dg2Hj5Lm8",
"recording": "on",
})
print(whats_app_number)