A web call connects a browser microphone to an agent over WebRTC, with no phone number. Your backend creates the call and gets an access_token; your page joins the call with the web SDK. Web calls use the same agent, prompt, tools and post-call analysis as phone calls, and count against the same concurrency limit.
There are three ways to start one:
- Your own page, with
POST /v3/create-web-callfrom your server and@tried/web-sdkin the browser. - A public key, so the browser can call
POST /v3/create-web-callitself from an allowed domain. See Chat widget. - A Voice Orb share link, a hosted page anyone with the link can use.
Create the call on your server#
curl -X POST https://api.tried.com.au/v3/create-web-call \
-H "Authorization: Bearer $TRIED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_8e0c...",
"dynamic_variables": { "first_name": "Sam" },
"metadata": { "session": "abc" }
}'POST /v2/create-web-call is an alias.
| Field | Type | Default | Description |
|---|---|---|---|
agent_id |
string | required | The agent to talk to. |
agent_version |
integer or string | latest | Version number. On /v3/create-web-call it may also be latest, latest_published or an environment tag name such as prod. |
dynamic_variables |
object | {} |
Dynamic variables. Non-string values are converted to strings. |
metadata |
object | {} |
Stored on the call. |
The response is HTTP 201 with the call object (call_type: "web_call", call_status: "registered", direction: null) plus:
| Field | Description |
|---|---|
access_token |
Token the browser joins with. Valid for 1 hour. |
livekit_url |
The media server URL to connect to. |
expires_at |
Token expiry, epoch milliseconds. |
transport |
"livekit". |
ice_servers |
ICE servers returned to browser clients. Default [{ "urls": ["stun:stun.l.google.com:19302"] }]. The media server negotiates its own TURN. |
Keep your API key on the server. Send only access_token and livekit_url to the browser.
Join from the browser#
@tried/web-sdk wraps livekit-client and exports TriedWebClient.
import { TriedWebClient } from "@tried/web-sdk";
const client = new TriedWebClient();
client.on("call_started", () => console.log("connected"));
client.on("agent_start_talking", () => setTalking(true));
client.on("agent_stop_talking", () => setTalking(false));
client.on("update", ({ transcript }) => render(transcript));
client.on("call_ended", () => console.log("ended"));
client.on("error", (err) => console.error(err));
const { access_token, livekit_url } = await fetch("/api/start-call", { method: "POST" }).then((r) => r.json());
await client.startCall({ accessToken: access_token, livekitUrl: livekit_url });startCall options#
| Option | Type | Description |
|---|---|---|
accessToken |
string | Required. From create-web-call. |
livekitUrl |
string | From create-web-call. Defaults to the client's url option, then wss://livekit.tried.com.au. |
sampleRate |
number | Microphone sample rate. |
captureDeviceId |
string | Microphone device. |
playbackDeviceId |
string | Speaker device. |
emitRawAudioSamples |
boolean | Emit audio events with the agent's PCM samples as Float32Array. |
The microphone uses echo cancellation, noise suppression and auto gain control.
Methods#
| Method | Description |
|---|---|
startCall(config) |
Connect and turn on the microphone. |
stopCall() |
Leave the call and remove audio elements. |
mute(), unmute() |
Turn the microphone off and on. |
startAudioPlayback() |
Call from a click handler if the browser blocked autoplay. |
Events#
| Event | Payload | When |
|---|---|---|
call_started |
none | Connected and the microphone is on. |
call_ready |
none | The agent joined the room. |
agent_start_talking, agent_stop_talking |
none | The agent's state changes to and from speaking. |
update |
{ transcript: { role, content }[] } |
The live transcript changed. role is agent or user. |
metadata |
any | JSON data sent on the metadata topic. |
audio |
Float32Array |
Agent audio samples, only with emitRawAudioSamples. |
call_ended |
none | You stopped, the room disconnected, or the agent left. |
error |
error | Connection or transcript errors. |
The agent leaving the room ends the call on the client.
Voice Orb share links#
A Voice Orb link is a public page at /orb/<token> where anyone with the link can talk to an agent in their browser. Use it to share an agent with a colleague or a client before you build your own front end.
Open the share dialog#
In the agent builder, click the share icon next to Publish (Share a Voice Orb link).
Create a link#
Click Create link. Copy the URL, or open it with the external link icon.
Revoke it#
Click the bin icon on a link to revoke it. The page stops working at once.
The page shows the agent name, the workspace name and an animated orb. The visitor talks by voice: the page calls POST /public/share/<token>/web-call, which creates a normal web call with metadata.source: "voice_orb".
- Calls are billed to the workspace that owns the agent.
- When the workspace is out of credit or over its monthly budget, the page gets HTTP 402.
- API endpoints:
GET /agents/:agent_id/share-links,POST /agents/:agent_id/share-links,DELETE /share-links/:id. Each link hasshare_link_id,token,enabledandurl_path.
Test in the dashboard#
The agent builder's Test Audio panel runs a web call against the current draft. Call transfer does not work in web calls because there is no phone line to transfer.
Limits and gotchas#
- Web calls count against the workspace concurrency limit and cannot use reserved inbound slots. A full workspace returns 429.
- The access token expires after 1 hour. Create the call right before the user joins.
- Voicemail, IVR and call screening detection also runs for the first 3 minutes of web calls.