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. The SDK exposes call state, the live transcript, and raw audio, so you can build captions, talking-avatar animations, or your own call controls.
- Development and testing. A web call is the fastest way to talk to an agent while building it. For a quick test without writing code, use the dashboard’s web call testing.
How it works
A web call has two halves:- Your server calls the create web call API with your Retell API key and receives an
access_token. - Your frontend passes that token to the Web SDK’s
startCall(), which connects the user’s microphone and speakers to the agent.
Set up web calls
1
Install the Web SDK
2
Create a server endpoint to get an access token
On your server, call create web call with the
agent_id of the agent that should answer, and return the access_token to your frontend.server.js
agent_id is the only required field. The optional fields you’ll reach for most:See the create web call API reference for the full request and response schema.
3
Start the call from the browser
Fetch the access token from your endpoint and pass it to The browser prompts the user for microphone permission on the first call. Microphone access only works in a secure context, so serve your page over HTTPS (localhost also works during development).
startCall().startCall() accepts these options:4
Listen to call events
The SDK emits events for call state, agent speech, and the live transcript. Use them to drive your UI.The full list of events:
5
End the call
call_ended.Control audio during the call
Mute and unmute the user’s microphone without ending the call:startAudioPlayback() inside one:
After the call
The liveupdate event only carries recent transcript sentences, so collect full results after the call ends:
- Register a webhook to receive
call_started,call_ended, andcall_analyzedevents on your server. - Fetch the complete transcript, recording, and analysis with the get call API, or review the call in session history.
Example project
For a complete working example with a React frontend and a Node.js server, see the web call demo repository.FAQ
Why does my call fail before it starts?
Why does my call fail before it starts?
The access token expires 30 seconds after
create-web-call returns it. Create the call when the user clicks to start, not when the page loads.Why can't the user hear the agent?
Why can't the user hear the agent?
Browsers block audio playback until the user interacts with the page. Start the call from a click handler, or call
startAudioPlayback() inside one.Why doesn't the microphone work?
Why doesn't the microphone work?
The user may have denied the browser’s 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, like the customer’s name. Use metadata for values you only need to look up later, like 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.
How do I get the full transcript after the call?
How do I get the full transcript after the call?
The
update event only carries the last 5 sentences. After the call ends, fetch the full transcript with the get call API or receive it through a webhook.
