Class: BabelconnectEmbed
A mounted embed. Use the verb groups (auth, calls,
session, context, app) to drive the app, and
on to receive app→host events (agent.loaded, cti.call,
cti.error, …).
Properties
app
readonly app: {
setTab: (tab) => void;
};
Route the agent to a tab: phone | chat | history | outbound.
setTab()
setTab: (tab) => void;
Parameters
tab
string
Returns
void
auth
readonly auth: {
set: (args) => void;
};
Refresh the bearer token (and optionally session/context) mid-session —
e.g. ahead of expiry on a long shift. Posts auth.set immediately; the
live app applies it in place without interrupting the session or any
active call. Also remembers the values as current, so if the
iframe later reloads and re-emits ready, the handshake hands off this
refreshed token rather than the one passed to BabelconnectEmbed.mount.
set()
set: (args) => void;
Parameters
args
Returns
void
calls
readonly calls: {
dial: (number, dial) => void;
};
Click-to-dial: place a call (or dial=false to only pre-fill the dialer).
dial()
dial: (number, dial) => void;
Parameters
number
string
dial
boolean = true
Returns
void
context
readonly context: {
set: (args) => void;
};
Merge into the persisted shared context carried onto subsequent calls/SMS.
set()
set: (args) => void;
Parameters
args
Record<string, unknown>
Returns
void
session
readonly session: {
set: (args) => void;
};
Attach session correlation; a number pre-fills a new SMS.
set()
set: (args) => void;
Parameters
args
Record<string, unknown>
Returns
void
Accessors
element
Get Signature
get element(): HTMLIFrameElement
The underlying iframe (e.g. to adjust sizing).
Returns
HTMLIFrameElement
Methods
dispose()
dispose(): void
Remove the iframe and stop listening.
Returns
void
on()
on(name, fn): () => void
Subscribe to an app→host event. Returns an unsubscribe fn.
Parameters
name
string
fn
Returns
Function
Returns
void
mount()
static mount(opts): BabelconnectEmbed
Mount the embed: inject the iframe and start the bridge.