Skip to content

client.whatsapp_calls

Calls your business places to WhatsApp users. These methods are on client.whatsapp_calls, 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.

Call a WhatsApp user. Calls a WhatsApp user from one of your WhatsApp numbers, with an assistant (mode: ai) or with an agent in the browser (mode: agent: the agent’s browser rings first, then the user). The user must have allowed your business to call them (409 permission_required otherwise) and WhatsApp’s call limits per user apply (429 limit_reached, with the limits in details and when they reset in details.resets_at); biz_opaque_callback_data goes to WhatsApp with the call as written; the do-not-call list applies as for any call. Needs a live key and WhatsApp calling enabled for the organization. The Idempotency-Key header is required, so a retried request never calls anyone twice. The call is a normal call: follow it with GET /v1/calls/{id} and the call.* webhooks.

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

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

Field Type Required Description
mode "ai" | "agent" yes ai: the assistant talks to the user. agent: the agent’s browser rings first; the user is called once they answer.
agent_id string no mode agent: the member who talks, in the browser. Required with mode agent.
assistant_id string no mode ai: the assistant that talks (default: the number’s assistant).
biz_opaque_callback_data string no Your data for this call at WhatsApp (biz_opaque_callback_data, at most 512 characters): WhatsApp returns it in the call’s own webhooks (status and terminate), so a relay can match them to its records. Sent as written; returned on the call object.
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.
recipient string no The WhatsApp user to call by the business-scoped ID WhatsApp gave you, when they don’t share their number. Instead of to.
to string no The WhatsApp user to call: their WhatsApp number (country code first, + optional).
whatsapp_number_id string no The business number that calls (one of yours).
whatsapp_phone_number_id string no WhatsApp’s ID of the business number that calls (digits), instead of whatsapp_number_id.

WhatsAppCall:

Field Type Description
id string The call’s ID (GET /v1/calls/{id}).
object "whatsapp_call" Always whatsapp_call.
livemode boolean true in live mode, false in test mode.
mode "ai" | "agent" —
status "queued" | "ringing" ringing: the user’s phone rings. queued: ringing the agent first (mode agent), or WhatsApp has not confirmed the call yet. Follow the call with GET /v1/calls/{id} or the call.* webhooks.
wacid string | null WhatsApp’s ID of the call; null until WhatsApp named it.
whatsapp_number_id string The business number that calls.
to string | null The user’s WhatsApp number in E.164 (null when called by recipient).
recipient string | null The user’s business-scoped WhatsApp ID (null when called by to).
assistant_id string | null asst_… ID.
agent_id string | null usr_… ID.
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.
biz_opaque_callback_data string | null Your data for this call at WhatsApp (biz_opaque_callback_data, at most 512 characters): WhatsApp returns it in the call’s own webhooks (status and terminate), so a relay can match them to its records. Null when none was sent.
created string An ISO-8601 timestamp in UTC.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
whats_app_call = client.whatsapp_calls.create({
"assistant_id": "asst_7Kp1Ns4Vy6Ab9Dg2Hj5Lm8",
"biz_opaque_callback_data": "chat_88:req_4f2a",
"metadata": {
"crm_contact_id": "0031x00000AbCdE",
},
"mode": "ai",
"to": "972501234567",
"whatsapp_number_id": "wan_4Gk2LmN9pQ4rS6tV8wX0yZ",
})
print(whats_app_call)