Prerequisites
- A Truedy account with an active agent
- Your Truedy API key (Settings → API Keys)
- Node.js 18+ or Python 3.9+ for the server component
- A modern browser (Chrome, Edge, Firefox, or Safari 15.4+)
1
Install the Ultravox client SDK
The Ultravox SDK handles WebRTC negotiation and the audio session in the browser.If you are not using a bundler, you can load it from a CDN:
2
Create a server endpoint that issues a joinUrl
Your server calls the Truedy API to start a WebRTC session and returns the single-use Set the required environment variables before starting your server:
joinUrl to the browser. The browser never sees your API key.3
Build the browser page
Create a minimal
index.html. This is a complete, self-contained example — no build step required.index.html
4
Test it
- Start your server (
node index.jsorflask run) - Open
http://localhost:3000in your browser - Click Talk to AI
- Accept the microphone permission prompt
- Speak — your agent will respond in real time
Key concepts
The joinUrl is single-use
Every call toPOST /webrtc/call produces a unique joinUrl that can only be joined once. Never cache or reuse it. If a user refreshes the page, your frontend must request a new joinUrl from your server.
API key stays on the server
Your Truedy API key authenticates you toapi.truedy.ai. It must only ever exist in server-side code or environment variables — never in HTML, JavaScript files served to the browser, or version control.
Microphone permissions
The Ultravox SDK callsgetUserMedia internally when joinCall is invoked. The browser will display a native permission prompt the first time. If the user denies microphone access, joinCall throws an error — handle it gracefully in your UI.
Next steps
Custom UI and live captions
Subscribe to transcript events for real-time captions and build a fully branded call UI.
Template variables
Pass dynamic data into your agent’s prompt at call time using template variables.
Widget builder
Use Truedy’s no-code widget builder to embed a pre-built voice button without writing frontend code.
Production security checklist
Review authentication, rate limiting, and webhook signature verification before going live.

