Skip to main content

TypeScript SDK

Use @babelforce/babelconnect-sdk to build your own browser interface around live agent state. Your first softphone is the complete setup and working example.

Install

npm install @babelforce/babelconnect-sdk

The package is ESM-only, targets ES2022, and is side-effect-free for tree shaking. It runs in modern browsers and Node 20+ for control-only use. CommonJS callers use a dynamic import: const { BabelconnectClient } = await import("@babelforce/babelconnect-sdk").

Browser audio needs microphone permission and a secure context (HTTPS or localhost). The SDK speaks gRPC-web directly to the server; no separate protocol proxy is required. Token exchange uses the same origin's /oauth/token, but the PKCE consent page may use another origin. If your app has a different origin, add it to the server's CORS allowlist. An empty list allows all origins and is intended for development only.

Which entry point?

GoalEntry pointGuide
Custom UI with browser audiopackage rootTutorial · Client lifecycle
State, SMS or external-phone controlpackage root, mediaFactory: nullControl only
Ready-made agent UI@babelforce/babelconnect-sdk/embedEmbedding

API surface at a glance

AreaReference
Connection and optionsBabelconnectClient · ConnectOptions
State and intentsState & events · Intents
Login, PKCE, revocationAuthentication
Custom WebRTCMedia · MediaFactory
Every exportTypeScript API

Porting a Go client? Read TypeScript vs Go before relying on defaults.