mv.webCalls
Browser calls started with a publishable key. These methods are on mv.webCalls, 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()”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.
mv.webCalls.create(body: WebCallsCreateData["body"], options?: RequestOptions): Promise<WebCallsCreateResponse>POST /web_calls · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
body.assistant_id |
string |
yes | The assistant to talk to. With a publishable key it must be public (widget settings). |
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.practice |
WebCallPracticeParamsInput |
no | Makes the web call a practice call: the assistant (assistant_id) lends the AI customer its voice and models; the scenario replaces its instructions, first message, tools, knowledge and flow. A practice call is not a call: it has no call record, no call webhooks and is never billed as a call. The transcript and the score on your QA rubric are on the practice session (GET /v1/practice_sessions/{id}). Secret keys only. |
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”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. |
practice_session_id |
string |
A practice web call’s session (GET /v1/practice_sessions/{id}): its transcript and score. Present only on practice web calls. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const webCall = await mv.webCalls.create({ assistant_id: "asst_8tRPaZp5hLMbrGqdJ9AmNa", metadata: { page: "/pricing", },});console.log(webCall);retrievePracticeSession()
Section titled “retrievePracticeSession()”Retrieve a practice session. A practice web call’s result (POST /v1/web_calls with practice returns its id): the transcript (rep and customer lines) and, once status is scored, the score on your QA rubric with each item’s reasoning, the strengths and the coaching. It exists once the browser has joined the call; poll after the call ends (scoring takes a few seconds). Test keys read test-mode practice sessions only.
mv.webCalls.retrievePracticeSession(id: WebCallsRetrievePracticeSessionData["path"]["id"], options?: RequestOptions): Promise<WebCallsRetrievePracticeSessionResponse>GET /practice_sessions/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A practice session ID (prs_…). |
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”PracticeSession:
| Field | Type | Description |
|---|---|---|
id |
string |
A practice session ID (prefix prs_). |
object |
"practice_session" |
Always practice_session. |
run_id |
string |
Your practice.run_id. |
call_id |
string |
The practice web call’s id (it has no call record). |
status |
"live" | "scoring" | "scored" | "too_short" | "failed" | "abandoned" |
live during the call, scoring right after it, then scored; too_short (the rep said too little to score), failed (it could not be scored) or abandoned (the call never finished). |
scenario_title |
string |
— |
language |
"he" | "en" | "ar" | "ru" |
— |
transcript |
PracticeLine[] |
— |
scorecard |
PracticeScorecard | null |
Null until scored. |
duration_s |
number | null |
— |
end_reason |
string | null |
— |
metadata |
Record<string, string> |
The web call’s metadata, with purpose: practice and practice_run_id. |
started_at |
string |
An ISO-8601 timestamp in UTC. |
ended_at |
string | null |
— |
scored_at |
string | null |
— |
livemode |
boolean |
true in live mode, false in test mode. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const practiceSession = await mv.webCalls.retrievePracticeSession("prs_7Hk2Lm9Qp");console.log(practiceSession);