client.web_calls
Browser calls started with a publishable key. These methods are on client.web_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.
create()
Section titled “create()”Start a web call. From the browser with a publishable key (mv_live_pk_…), or from your server with a secret key: returns the call ID and a single-use client token for /ws/call. With a publishable key the assistant must be public, the page must be one of the key’s allowed origins (and of the assistant’s widget origins, when it lists any), and each visitor may start 10 web calls a minute. The org’s concurrent-call quota applies.
def create(self, body: _m.WebCallCreateParamsInput | Mapping[str, Any], *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.WebCallclient.web_calls.create() · await async_client.web_calls.create() · POST /web_calls · API reference
Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
assistant_id |
string |
yes | The assistant to talk to. With a publishable key it must be public (widget settings). |
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. |
Returns
Section titled “Returns”WebCall:
| Field | Type | Description |
|---|---|---|
object |
"web_call" |
Always web_call. |
call_id |
string |
The call this web call will be (GET /v1/calls/{id} once it starts). |
assistant_id |
string |
A assistant ID (prefix asst_). |
client_token |
string |
Single use; connect within expires_at. |
ws_url |
string |
Connect to <ws_url>?client_token=<client_token>. |
expires_at |
string |
An ISO-8601 timestamp in UTC. |
livemode |
boolean |
true in live mode, false in test mode. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
web_call = client.web_calls.create({ "assistant_id": "asst_8tRPaZp5hLMbrGqdJ9AmNa", "metadata": { "page": "/pricing", },})print(web_call)