Web SDK
The Devotel Web SDK (@devotel-orbit/web) is the browser-side SDK that powers the embeddable Orbit Chat widget, the WebRTC softphone, on-site personalisation, and Web Push (VAPID) re-engagement notifications. It ships as native ES module + CommonJS builds with subpath exports per surface (./softphone, ./personalization, ./push, ./push/service-worker, ./widget) and has no peer-dependency on a framework (works in vanilla, React, Vue, Svelte, Solid).
Installation
jssip as an optional peer dep:
Softphone.
Quick Start
The SDK exports several product surfaces — pick only what you need. The Quick Start below wires the four most common (chat, softphone, personalisation, push). Every other GA surface ships from the same package and is documented under Modules: the embeddable AI voice-agent widget (OrbitVoiceAgent), the prebuilt video-room widget (OrbitVideoRoom), the CRM CTI bridge (OrbitCTI) and its Salesforce Open CTI adapter (SalesforceOpenCtiAdapter), the Segment-compatible CDP analytics clients (OrbitCdpAnalytics / OrbitCdpAnalyticsQueue), the public-key website tracking client (OrbitWebAnalytics), in-app messages and content cards (OrbitInApp), gradual rollouts (OrbitFeatureFlags), the drop-in verification UI (OrbitVerify), and QM desktop capture (ScreenCaptureController).
Modules
Chat widget — OrbitChat
Embeds the same Inbox-backed live chat that operators see on the dashboard. The widget supports text, file uploads, typing indicators, AI-agent fallback, and human-handoff escalation. Constructor options set in code are fallback defaults — once you configure the widget in the console (brand color, position, agent identity, business hours, GDPR consent, origin locking), the console values take precedence over the embedded defaults. See the Native Chat channel configuration guide for the console surface.
Softphone (SIP / WebRTC voice) — Softphone
A JsSIP-backed softphone that places outbound PSTN calls or joins inbound voice flows. Call control hooks into Orbit’s voice routing rules (IVR, AI agent, human handoff). Two-step auth: your server exchanges a server-issued JWT (or, less commonly, an API key) for short-lived SIP credentials via POST /voice/softphone/register, then the browser opens a JsSIP WSS to the Orbit WSS (Kamailio) gateway (the wssUrl returned by POST /voice/softphone/register).
softphone.unregister() to stop the renewal loop.
See Voice operations below for the full call-control surface (hangup, hold, mute, DTMF, transfer, conference, recording, webhooks).
Web Push subscriptions — OrbitPush
VAPID + RFC-8030/8291/8292 compliant push registration. Always feature-detect with OrbitPush.isSupported() first — Safari pre-16.4 and browsers without PushManager will throw otherwise.
import — because of that, the worker must be registered as a module worker (navigator.serviceWorker.register('/orbit-push-sw.js', { type: 'module' })):
scope: "/" to receive pushes for any path. The expectedTenantId guard is compared against each payload’s tenant_id, so it must be the tenant_<id> value your push payloads carry (not an org_-prefixed id) — any mismatch is dropped to prevent cross-tenant leakage.
Backend: register VAPID subscriptions from any server
OrbitPush.register() above reports the subscription to Orbit on its own. When your server registers subscriptions itself — a server-rendered flow, a bulk import — it calls POST /api/v1/push/device-tokens with platform: 'web' and the browser’s PushSubscription.toJSON() envelope as subscription, authenticated with a secret key:
platform: 'web' the token field returns Orbit’s canonical
webpush:<base64url> encoding of your subscription (the SDK reuses it on
rotation), and data.id is the handle you delete on sign-out:
201 Created
last_seen is bumped
and the 201 returns the original id, never a duplicate. On sign-out,
unregister so the browser stops receiving pushes:
Unregister on sign-out (204)
?token=<raw-token> to the same DELETE and the route falls back to
matching the stored token.
To exercise the flow against your sandbox organization, use a key minted
there (dv_test_sk_…); dashboard sessions add X-Test-Mode: true via the
console’s Test/Live toggle. See
Sandbox API samples.
This subsection is the one place on this page that takes a secret key —
every browser surface above authenticates with the publishable key, and
the split is the point: browser code is extractable, so the secret stays
on your server. Delivery-side mechanics (payload shape, scheduling) live
in the push channel reference.
Personalisation — OrbitPersonalization
Identifies a visitor and fetches their contact_scores.segment_label server-side. Use the segment to swap copy, gate features, or trigger CTAs.
AI voice-agent widget — OrbitVoiceAgent
An embeddable browser WebRTC widget that lets a visitor press “Talk to AI” and hold a live voice conversation with one of your configured AI voice agents — the web front-door to Orbit’s voice AI (web onboarding + live demos), no inbound PSTN DID required. It self-paints a button and a lightweight waveform into the container you pass, mints a short-lived room token via POST /widget/voice-agent-session, and runs the call over the same WebRTC media stack as the softphone. Like OrbitChat, it authenticates with your public key (today the tenant org id) — never a secret.
Prebuilt video room — OrbitVideoRoom
A drop-in multi-party video-call widget — you pass a container element, a room token, and the media server URL, and it paints a complete conferencing UI: a participant tile grid, a local self-view, and a control bar with mute, camera, screen-share, a device picker (microphone / camera / speaker, switchable mid-call), background blur, and leave. Remote video and audio tracks attach to the right tile automatically as they are subscribed.
Two token minting paths, depending on where the page lives:
- Authenticated join route —
POST /api/v1/video/rooms/:id/join, called by YOUR backend with an Orbit API key. Use this for dashboard, moderator, or partner-embedded rooms where a credential exists server-side ({ token, livekit_url | ws_url }in the response). - Anonymous guest session —
POST /widget/video-session(public), called directly from the visiting page. You pass the widgetpublic_key, theroom_id, and optionally avisitor_id/display_name. The request carries the browser’sOriginheader, and the minted identity is pinned to theparticipantrole — an anonymous visitor can never mint moderator or host privileges. Use this for public pages: a support portal, a telehealth lobby, an open webinar.
{ token, livekit_url | ws_url } in the response payload — hand both to the widget init (abbreviated data envelope omitted above for clarity).
data-orbit-video-room attribute, so you can restyle the widget with plain CSS. Rooms can be configured with a background-blur policy (off / allowed / required) — the widget reads it from the room and forces blur on when required, matching the mobile SDKs.
CRM CTI bridge — OrbitCTI
An iframe-embeddable click-to-dial + call-state bridge a CRM admin drops into a Salesforce / HubSpot / Zendesk sidebar — Orbit’s answer to the Genesys / Five9 / Talkdesk OpenCTI adapters. The host page fires events and calls dial(); all media transport lives inside the iframe, so the host page never touches jssip or livekit-client. Your backend mints the embed token server-side (or via a trusted same-origin proxy) and hands it to init().
CDP analytics (Segment-compatible) — OrbitCdpAnalytics
A Segment-compatible analytics ingest client — track, identify, alias, page, screen, group, batch — that signs each request (HMAC, timestamp + nonce) inside the SDK boundary using the WebCrypto API, so it runs in any modern browser, Cloudflare Workers, Vercel Edge, Deno, and Bun. It mirrors the Node SDK’s CdpAnalyticsClient on the same wire contract, so a request signed by either client verifies identically server-side.
This client holds an ingest secret, not a public key. The ingest secret MUST stay server-side — do not ship it in your page bundle. UseOrbitCdpAnalyticsonly on a trusted edge / SSR surface (read the secret from your environment), or proxy the signing through your own backend. For pure browser-side eventing, prefer the public-keyOrbitPersonalizationsurface above, which never needs the ingest secret.
OrbitCdpAnalyticsQueue wraps the same client with a sticky anonymousId, batched flush, retry with exponential backoff, and offline survival via localStorage — an analytics.js-style drop-in on top of the base OrbitCdpAnalytics.
Public-key website tracking — OrbitWebAnalytics
The browser-side tracking snippet for self-serve website analytics: an analytics.js-style client that authenticates with your public key (dv_live_pk_… / dv_test_pk_…), so it is safe to paste into any webpage, and posts to the same public ingest surface OrbitPersonalization uses (/sdk/identify, /sdk/track, /sdk/track/anonymous). The split with OrbitCdpAnalytics is the auth model: OrbitCdpAnalytics signs requests with an HMAC ingest secret and belongs on a trusted edge/SSR surface, while OrbitWebAnalytics carries only the publishable key and belongs in the page. Choose OrbitWebAnalytics for plain website tracking (pageviews, clicks, anonymous funnels that merge into contacts on identify); choose OrbitCdpAnalytics/OrbitCdpAnalyticsQueue when events are signed server-side with the ingest secret.
Identity works like analytics.js: a sticky per-browser anonymousId (localStorage) ties anonymous events into one funnel across page loads, and identify() resolves the visitor to a contact from email / phone traits. Events sent before identify() are backfilled onto the resolved contact server-side. Events buffer in-page and flush as one batched request (20 events or 2 s by default, capped at the server’s 50-events-per-call limit), and a pagehide listener flushes the remainder on navigation: fetch with keepalive first, falling back to sendBeacon against the key-less anonymous endpoint, so the last events survive tab close.
track() with an empty event name and group() without a groupId are ignored rather than sent. The public key rides on a request header, never the URL; failed flushes are re-queued (bounded at 200 events) and retried on the next flush.
In-app messages and content cards — OrbitInApp
The render surface for Orbit’s owned in-app channel: persistent content cards rendered into a container you choose, and transient in-app message overlays (modal, slide-up, fullscreen, or custom HTML) shown during a session. The server assembles the eligible feed per visitor (segment-targeted, expiry-filtered); the SDK fetches it, renders it into your DOM, and reports impression / click / dismiss engagement back to Orbit. There is no carrier leg, and like every public-key surface it authenticates with your public API key.
fetchFeed() returns an empty feed on any transport error so a flaky network never breaks your page, and a dismissal recorded with dismiss() is filtered client-side immediately (and server-side on the next fetch). The pure assembleInAppFeed(feed, { now, dismissedIds }) helper is exported for rendering the feed in your own UI while staying byte-for-byte consistent with the SDK’s ordering rules (pinned-first, priority-sorted, MAX_CONTENT_CARDS cap).
Feature flags — OrbitFeatureFlags
A LaunchDarkly-style gradual-rollout client: gate a feature on a CDP segment, ramp it to a percentage of units, or split traffic across weighted variants. The ruleset is fetched once with refresh() (or supplied inline via bootstrap, or pushed in from your own edge cache with setDefinitions()), and every read is a pure local computation — page render never blocks on a flag call.
Rollout inclusion and variant choice are a deterministic hash of (flagKey, unitId), which gives you stickiness by construction: a visitor lands in the same bucket across reloads and sessions, and raising rolloutPercentage only ever adds units, never flips someone back out. The bucketing unit is the user.id you pass (or identify() later); before login it is a sticky anonymous id shared with OrbitPersonalization, so pre-login rollouts stay stable.
publicKey + apiUrl, refresh()), inline bootstrap (ship the ruleset with the page for a non-blocking first paint), and self-hosted (serve the ruleset from your own backend/edge cache via flagsUrl, or push it in with setDefinitions()). identify({ id, segments }) re-buckets for the logged-in user and re-checks segment gates; per-unit overrides in a flag definition win over every other rule, including the enabled: false kill switch, and each evaluation carries a reason (OVERRIDE, DISABLED, SEGMENT_MISS, ROLLOUT_EXCLUDED, ROLLOUT_INCLUDED, VARIANT) for debugging rollouts.
For server/edge parity, the pure core is exported: bucketOf(salt, flagKey, unitId) returns the same [0, 100) bucket your edge worker computes, and evaluateFlag(def, context) / evaluateAllFlags(defs, context) evaluate a ruleset byte-for-byte identically to the browser. Use them in an edge worker to make routing or SSR decisions that can never disagree with what the widget renders. refresh() requires publicKey plus apiUrl or flagsUrl and throws otherwise.
Drop-in verification UI — OrbitVerify
A prebuilt verification widget that drives the whole sequence for you: it silently attempts Silent Network Auth (SNA) one-tap first, and when the network can’t assert the number it falls back to an OTP the user types in (SMS by default; WhatsApp, email, voice, Viber, and Telegram also supported). It paints a status line plus a code field with autocomplete="one-time-code" (so mobile browsers offer SMS autofill), resend, and attempt counting — no hand-wired multi-factor flow. Like the other prebuilt widgets it also registers as the <orbit-verify> element, covered in the Orbit Elements guide.
baseUrl points at a proxy on your backend that fronts Orbit’s authenticated /verify routes with your secret key (the same model OrbitVideoRoom uses for token minting): the built-in transport POSTs the silent-auth attempt to <baseUrl>/verify/silent-auth, the OTP send to <baseUrl>/verify/send, and the check to <baseUrl>/verify/check (override the paths with endpoints, add e.g. a CSRF header with fetchHeaders, or replace the transport wholesale with transport). Silent auth is best-effort by design: only an explicit network assertion verifies, and anything else (unavailable, malformed, thrown) falls back to OTP, so a flaky network dip never blocks the user. Every rendered element carries data-orbit-verify hooks for theming, and all copy is overridable via labels. OTP delivery itself runs through your existing verify pipeline. The factor model, channel matrix, and server-side /verify endpoints are documented in the Verify overview.
Salesforce Open CTI adapter — SalesforceOpenCtiAdapter
The translation layer between Salesforce’s native Open CTI API (sforce.opencti) and the Orbit CTI client, so agents take Orbit calls inside the Salesforce softphone panel without leaving the CRM. It pairs with the generic OrbitCTI bridge: you still mint the embed token server-side and construct OrbitCTI as usual, then hand it to the adapter, which wires three behaviors on top:
- Click-to-dial — Salesforce
onClickToDialpayloads are normalised to E.164 (CRM-formatted national numbers get the configured country prefix) and placed throughcti.dial(...). - Screen pop — when a dial did not originate from a known record, Orbit
call:statetransitions drivesearchAndScreenPop(...)so the matching CRM record opens. - Activity logging — on call end the adapter writes a Salesforce
Task(Subject,CallType,CallDurationInSeconds,Status) linked viaWhoIdfor Contact/Lead andWhatIdotherwise; disable withlogCalls: false.
attach() throws with a clear message when window.sforce.opencti is unavailable (load Salesforce’s opencti_min.js before attaching, or pass opencti). Undialable click-to-dial numbers surface as an onEvent error with code INVALID_NUMBER instead of dialling garbage; the exported normalizeSalesforceNumber(raw, defaultCountryCode) helper shows exactly how a raw CRM value maps to E.164. All media transport stays inside the Orbit CTI iframe; the adapter itself carries no WebRTC/SIP stack and wires no carrier.
QM desktop capture — ScreenCaptureController
The browser half of Quality Management screen recording: it captures the agent’s desktop during a call (time-aligned with the call audio) and hands your host application a finished Blob to upload to your QM ingest pipeline — see the desktop screen-recording ingest guide for the server side. Capture is tenant-policy gated, single-use per share (construct a fresh controller for a new share), and audio is hard-pinned off: the conversation is already recorded on the telephony leg, so the controller records video only.
start() evaluates the policy before the browser picker ever opens, so a disabled tenant or an un-consented agent never sees a prompt; if the agent dismisses the picker the status moves to denied (a clean outcome, not an error). The recorder flushes in 2-second timeslices so a crashed tab still leaves a partially playable recording, the browser’s own “stop sharing” bar is treated as a clean stop, and maxDurationSeconds is enforced by a background guard. Encoding is negotiated from video/webm;codecs=vp9 through video/mp4 (Safari); when no supported type exists, start() refuses with an error event rather than recording an undecodable blob.
Orbit Elements — declarative <orbit-*> web components
Every prebuilt widget above also ships as a Custom Element — <orbit-chat>, <orbit-verify>, <orbit-video-room>, <orbit-click-to-call>, plus a thin <orbit-preference-center> iframe — so a page with no JavaScript build pipeline mounts the same engine from a plain HTML tag instead of a <script type="module"> bootstrap. Headless clients (Softphone, OrbitPersonalization, OrbitPush, OrbitWebAnalytics, OrbitInApp, OrbitFeatureFlags, SalesforceOpenCtiAdapter, ScreenCaptureController, OrbitCdpAnalytics*) have no element form; use the imperative classes below. Register all five with one call (defineOrbitElements() from @devotel-orbit/web/elements) or via the self-hosted dist/orbit-elements.iife.js script tag; the elements re-dispatch their engine’s lifecycle as bubbling CustomEvents (orbit-state, orbit-verified, orbit-ready, …) a plain addEventListener catches.
Voice operations
The browser softphone is a thin client over the JsSIP WebRTC stack. Call control happens on the liveCallSession object for the active call leg; for surface-area calls like recording, conferences, transfers to PSTN, transcripts, and dialer campaigns, your backend uses the Node SDK against the same call_id the browser exposes via session.id.
All snippets below match the SDK source in packages/sdk-web/src/softphone/.
Make a call
Get call details
Live state is on theCallSession. For historical details, query the server SDK with session.id:
Hang up a call
Answer an incoming call
Hold and mute
Send DTMF
Transfer a call
The browser softphone supports blind transfer (SIP REFER) directly on the call session. Warm (consult-first) transfer is a server-orchestrated flow — your backend callsvoice.calls.warmTransfer(session.id, ...) while keeping the local leg alive.
Conference call
Conferencing is server-orchestrated — the browser stays in its own leg while the backend bridges additional participants:Record a call
Recording is enabled at call setup — your backend setsrecord: true when minting the softphone JWT, or when triggering the outbound call. After hangup, fetch the recording from your backend:
Listen to a recording
Once your backend has the signed URL, drop it into a standard HTML5 audio element — no SDK API required:Voice webhook handling
Voice webhooks are server-side — the browser SDK should never accept inbound HTTPS. Wire your backend (see the Node SDK voice webhook guide) and forward state to the browser via your existing channel (WebSocket, SSE, or aBroadcastChannel):
Runnable examples
The package’sexamples/ directory holds self-contained end-to-end TypeScript files — each reads the publishable key (dv_test_pk_… / dv_live_pk_…) from ORBIT_PUBLIC_KEY: web-chat-widget.ts (OrbitChat.init() + programmatic open() / close() / sendMessage() / destroy()) and web-push-subscribe.ts (OrbitPush.register(), returns the device-token id + PushSubscriptionJSON envelope, or null on permission denial / unsupported browser). Swap sandbox vs live by changing the env value.
See packages/sdk-web/examples/README.md for sourcing the Service Worker file (orbit-push-sw.js) from the npm tarball’s dist/ folder.
Configuration
Each surface takes its own constructor options; the tables on this page cover the four Quick Start surfaces, and each Modules section documents its own options. For the four Quick Start surfaces, the API base URL is configured with a different option name on each surface — there is no single sharedbaseUrl.
Softphone is constructed via the Softphone.fromToken(jwt, opts) factory (where opts carries the outbound fromNumber and any per-call overrides), not a public key — see the Softphone module above.
Source
- npm: @devotel-orbit/web
- GitHub:
packages/sdk-web
Authentication
Web SDK surfaces (OrbitChat, OrbitPersonalization, OrbitPush) authenticate with public keys only (dv_live_pk_*). Public keys are scoped to surfaces that are safe to expose in browser code: chat widget submission, push subscription registration, personalisation events. They cannot send messages on behalf of arbitrary recipients, mutate billing, or access PII.
If you call the REST API directly from the browser, send the public key as Authorization: Bearer dv_live_pk_... whenever the X-API-Key custom header is blocked by CORS — the server accepts either form. See the authentication guide for details.
Softphone does NOT take a public key directly — your backend mints a short-lived JWT (≈ 60 minutes) via POST /voice/softphone/register using your dv_live_sk_* server key, and the browser receives only the JWT. The SDK then opens the SIP/WebRTC session against that JWT. This keeps your secret key server-side while still letting end-users place calls.
See the authentication guide for the full scope matrix.