Skip to main content
The Phonely Web SDK provides a TypeScript API for starting voice calls, controlling the microphone, listening for call events, and optionally receiving live transcript updates.

Install the SDK

This guide describes version 0.0.8.

Keep authentication on your server

Your browser must not receive your Phonely API key. Instead:
  1. The browser asks your application server to start a call.
  2. Your server authenticates the user and confirms that they may access the requested agent.
  3. Your server requests a short-lived web call session from Phonely using the API key.
  4. Your server returns the session bundle to the browser.
  5. The SDK uses that bundle to join the call.
Never include a Phonely API key in browser code, browser storage, URLs, screenshots, or client-visible logs.
Your server starts the short-lived session through Phonely:
Send an empty JSON object, or include the optional call metadata:
The response contains the values the browser SDK needs:
Return only this short-lived response to the browser. If Phonely provides an environment-specific API base URL for your account, use that URL instead.

Configure the browser client

Set webCallStartEndpoint to a server route in your own application:
The SDK sends the following body to your route:
Your route must return the short-lived session response produced by Phonely. If your application uses a custom authentication flow, provide createWebCallStart instead of webCallStartEndpoint.

Pass runtime variables

If a flow uses runtime variables, pass their IDs and values through metadata.callOverrides.liveVariables:
The uuid must match the runtime variable ID configured in the flow.

Use live transcripts

Enable transcript polling when the browser needs live caller and agent messages:
Transcript access uses the short-lived transcript URL and token returned for the call. clearTranscript() clears only the SDK’s in-memory copy; it does not delete stored call data.

Common methods

Use on(event, handler) and off(event, handler) to manage event listeners. The exported PhonelyEvent enum includes call lifecycle, participant, message, volume, speech, transcript, progress, and error events.

End the call

End the active call before starting another one with the same SDK instance.
Last modified on August 10, 2026