When to use web calls
- Voice inside your product. Add a support agent to your help center, a sales assistant to a landing page, or voice-guided onboarding, with a UI you fully control.
- Custom call experiences. Build call controls and audio visualizations. Enable live transcripts separately for captions or conversation flow updates.
- Development and testing. Talk to an agent while building it. For a quick test without writing code, use the dashboard’s web call testing.
Set up web calls
1
Install the Web SDK
2
Configure authentication
Create a public key and allow your website’s domain. Add
localhost to test locally. Use the public key in your browser code; keep API keys on your server.If your public key has reCAPTCHA enabled, obtain a fresh token before each call and pass it as recaptchaToken to createWebCall().3
Create and connect the call
Initialize
RetellClient and call createWebCall() from your button’s click handler. Replace the public key and agent ID with your own values.createWebCall() returns a session immediately with status: "connecting", then reports live and ended through onStatus. Audio may take a moment to connect after live. Once creation succeeds, call.callId identifies the call.The browser prompts for microphone permission. Serve your page over HTTPS; localhost also works during development.agent_id is the only required call option. Common optional fields:See Create Web Call for the REST request fields, and audio controls for browser audio options.
4
End the call
ended through onStatus and fires onEnd.Handle call events
Pass hooks when creating the call, as shown above, or register listeners on the returned session:
Reset call controls in
onEnd, including when no onError fires. Use Get Call for the recorded disconnection reason.
Enable live transcripts
Live transcripts use a separate monitoring WebSocket and are off by default. With the public-key client configured above, addtranscript: true:
onTranscript receives the full transcript so far and a separate array of pre-session tool calls. The SDK merges updates by each item’s stable ID. Items include spoken turns, tool calls, and flow nodes; see the transcript item spec. Transcript text can change as a turn progresses and does not mark exact speaking boundaries.
If the optional transcript connection fails, the SDK logs a console warning and the audio call continues. This failure does not fire
onError. See WebSocket authentication if you create calls through your own backend.Control audio during the call
Mute and unmute the microphone without ending the call:audio option of createWebCall():
Use
onAudio snapshots to calculate a level for an orb or volume meter. They contain incoming audio, including any background sound, and are sampled for visualization rather than continuous recording.
After the call
Collect full results after the call ends:- Register a webhook to receive
call_started,call_ended, andcall_analyzedevents on your server. - Use
call.callIdwith the get call API to fetch the complete transcript, recording, and analysis, or review the call in session history.
Example project
The React and Node.js demo usesRetellClient with an API key kept on the Node.js backend.
FAQ
Why does my call fail before it starts?
Why does my call fail before it starts?
Read the error passed to
onError. Check your public key’s allowed domains, the agent ID, and microphone permission. If reCAPTCHA is enabled, provide a fresh token for each call.Why can't the user hear the agent?
Why can't the user hear the agent?
Browsers can block audio playback before user interaction. Start the call from a click handler, or call
call.startAudioPlayback() inside one.Why doesn't the microphone work?
Why doesn't the microphone work?
The user may have denied microphone permission, or the page isn’t served over HTTPS. Microphone access requires a secure context; localhost works during development.
How do I pass customer data into the call?
How do I pass customer data into the call?
Use
retell_llm_dynamic_variables for values the agent should use in conversation. Use metadata for values you only need to look up later, such as an internal customer ID. See dynamic variables.Do web calls count toward my concurrency limit?
Do web calls count toward my concurrency limit?
Yes. Web calls draw from the same concurrency pool as outbound phone calls.

