Skip to main content
The live-listen SDK is a browser script that lets you subscribe to a live conversation’s audio and transcript from your own page. It connects as a read-only observer: you hear the call and receive transcript events, but you cannot speak and you are hidden from the other participants. Use it to build custom monitoring, supervisor, or QA tools outside the Anyreach dashboard. For the built-in monitoring experience, see Live monitoring.

How it works

The SDK is served as JavaScript at /public/listen-sdk. When you call AnyReach.listen(...), it injects a hidden iframe into your page and brokers all audio and transcript traffic through it over postMessage. You never handle the LiveKit connection directly.

Load the script

Add the script tag to your page. Point it at your Anyreach host.
This registers AnyReach.listen on window.

Get a token

AnyReach.listen requires a url and token, which you mint from the API.
This endpoint requires the conversations:read_sensitive or conversations:manage scope. Authenticate with Authorization: Bearer <token>; user PATs (pat_) also need X-Anyreach-Org: <organization_id>. The conversation must be in progress. If it is not active, the endpoint returns 409. If the conversation has no associated LiveKit room, it returns 404.
The response contains everything you pass to the SDK:
Mint the token from your backend, not the browser. The listener-token scopes grant access to sensitive conversation audio, so the credential you authenticate with should never reach the client.

Start a session

Wire your event handlers first, then call connect().
1

Create the session

Pass the url and token from the listener-token response.
2

Attach handlers

Register handlers before connecting so you do not miss early events.
3

Connect

connect() returns a promise that resolves once the listener is subscribed. It rejects on error or after a 15-second timeout.
4

Enable audio

Browser autoplay policy may suspend audio until a user gesture. Call startAudio() from a click handler.

Session API

AnyReach.listen({ url, token }) returns a session object with these methods.
mute() and unmute() control your local audio output only. They do not affect what the agent or caller hear.

Events

Subscribe with session.on(event, handler).
getState() and the stateChange event report idle, connecting, connected, or disconnected.

Full example

Next steps

Live monitoring

Listen to in-progress conversations from the Anyreach dashboard.

Agent Assist overview

See the full set of real-time assist capabilities.