Set up the SDK
Step 1: Install the Retell Web SDKnpm install retell-client-js-sdk
Step 2: Set up the SDK class
Call create-web-call to get call id
Your client code should call your server endpoint which internally calls
create web call to get the
access token for the call. The endpoint requires using your Retell API Key, which is the
reason why you need to call the endpoint from the server instead of the client to
protect the key from exposing.
The access token obtained will be used in your frontend client code to start the call.
Start the Call
Once call starts, you can listen to a couple of events that are emitted for real time updates about the call.Stop the Call
You can close a web call with the agent by usingListen to events
You can listen to events emitted by the SDK to get real time updates about the call, including who is speaking, the real time transcript, start and end of the call.Audio Basics
If you have not worked with audio bytes before, we strongly suggest you check out audio basics, which can help with choosing the best configuration here. PCM audio format conversion functionsconvertUnsigned8ToFloat32 and
convertFloat32ToUnsigned8 can be found in
audio basics.
