A WebSocket that pushes the full call object on every change until the call ends. It carries the same data as the SSE stream. Use it when your client prefers WebSockets.
Authenticate the upgrade request with Authorization: Bearer <api key> or the dashboard session cookie.
Request#
Path parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
call_id |
string | Yes | The call to watch. |
Example request#
websocat -H "Authorization: Bearer $TRIED_API_KEY" \
"wss://api.tried.com.au/v2/calls/call_8d1e0f2a3b4c5d6e7f8a9b0c/ws"import WebSocket from "ws";
const ws = new WebSocket("wss://api.tried.com.au/v2/calls/call_8d1e0f2a3b4c5d6e7f8a9b0c/ws", {
headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}` },
});
ws.on("message", (raw) => {
const msg = JSON.parse(String(raw));
if (msg.event === "call") console.log(msg.call.call_status, msg.call.transcript);
if (msg.event === "end") ws.close();
});
setInterval(() => ws.send(JSON.stringify({ type: "ping" })), 20000);import asyncio, json, os, websockets
async def main():
url = "wss://api.tried.com.au/v2/calls/call_8d1e0f2a3b4c5d6e7f8a9b0c/ws"
headers = {"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"}
async with websockets.connect(url, additional_headers=headers) as ws:
async for raw in ws:
msg = json.loads(raw)
if msg["event"] == "call":
print(msg["call"]["call_status"])
asyncio.run(main())Messages#
All frames are JSON text.
Server to client#
| Message | Description |
|---|---|
{ "event": "call", "call": {...} } |
The full call object. Sent once on connect and again on every change. |
{ "event": "pong" } |
Reply to a client ping. |
{ "event": "end", "call_id": "..." } |
The call reached ended, error or not_connected, or 30 minutes passed. The socket then closes with code 1000. |
{ "event": "error", "message": "Call not found" } |
The call is not in your workspace. The socket closes with code 4404. |
If the call has already ended when you connect, you get one call message followed by end.
Client to server#
| Message | Description |
|---|---|
{ "type": "ping" } |
Keeps proxies from closing an idle socket. The server answers with pong. |
The server checks the call every TRIED_MONITOR_POLL_MS (400 ms by default).
Errors#
| Status | When |
|---|---|
401 |
Missing or invalid API key or session. The upgrade is refused. |
403 |
The key's IP allowlist or scopes reject the request. This route needs the calls scope. |
Compatibility notes#
The path and message format are Tried specific: the socket pushes the whole call object on each change. Clients written for another monitor protocol need changes.