Element API

@avaya/infinity-elements-api v1.3.1


@avaya/infinity-elements-api

npm version

Element API for InfinityElements to interact with the Infinity Extensibility Framework. This library provides a robust interface for communication between web components and the Infinity Agent Desktop.

Table of Contents

Installation

npm install @avaya/infinity-elements-api

Features

  • 🔌 Easy Integration - Simple API for web components to interact with core-agent-ui
  • 📡 Event-Driven - Subscribe to interaction events (accepted, ended, status changes)
  • 🎯 Type-Safe - Full TypeScript support with comprehensive type definitions
  • 📞 Call Management - Complete call control (transfer, consult, hold, mute, etc.)
  • 👤 Agent Management - Get/set agent status, access user information
  • 💬 Messaging - Send rich media messages and interact with the chat feed

Quick Start

Basic Setup

import { ElementAPI } from "@avaya/infinity-elements-api";

// Create API instance
const api = new ElementAPI();

// Get user information
const userInfo = await api.getUserInfo();
console.log("Agent:", userInfo.firstName, userInfo.lastName);
console.log("Email:", userInfo.email);

// Listen for interaction events
api.onInteractionAccepted((interactionId) => {
  console.log("Interaction accepted:", interactionId);
});

api.onInteractionEnded((interactionId) => {
  console.log("Interaction ended:", interactionId);
});

// Don't forget to clean up!
// In React: useEffect cleanup, in plain JS: on element unmount
api.destroy();

React Example

import { ElementAPI } from "@avaya/infinity-elements-api";
import { useEffect, useState } from "react";

function MyElement() {
  const [userInfo, setUserInfo] = useState(null);

  useEffect(() => {
    const api = new ElementAPI();

    // Fetch user info on mount
    api.getUserInfo().then(setUserInfo);

    // Subscribe to interaction events
    const unsubscribe = api.onInteractionAccepted((interactionId) => {
      console.log("Interaction accepted:", interactionId);
    });

    // Cleanup on unmount
    return () => {
      unsubscribe();
      api.destroy();
    };
  }, [api]);

  return (
    <div>
      <h1>Agent: {userInfo?.displayName}</h1>
      <p>Status: {userInfo?.agentStatus}</p>
    </div>
  );
}

Core Concepts

ElementAPI

The main class for interacting with the Infinity Extensibility Framework. It handles:

  • API requests to core-agent-ui via window.postMessage
  • Event subscriptions for interaction lifecycle
  • Inter-element communication via the host (postMessage)

Triggering Workflows

Elements can programmatically trigger AXP workflows using triggerWorkflow(). The host (agent UI) executes the call so credentials are never exposed to the element.

// Trigger a workflow with input parameters
const result = await api.triggerWorkflow({
  workflowId: "wf-refund-process",
  inputData: { orderId: "ORD-123", amount: 49.99 },
});
console.log("Workflow started:", result.workflowSessionId);

Parameters:

ParameterTypeRequiredDescription
workflowIdstringYesID of the workflow to execute
workflowVersionstringNoWorkflow version (host defaults to "current" when omitted)
interactionIdstringNoInteraction context override (auto-attached for interaction-level widgets)
inputDataRecord<string, unknown>NoKey/value data forwarded to the workflow as inputs

Workflow → Element communication pattern:

Workflows communicate results back to elements through the shared interaction object rather than a direct return channel:

  1. Element calls triggerWorkflow({ workflowId, inputData })
  2. Workflow executes (may be short or long-running)
  3. Workflow writes results via an Update Interaction action, then signals completion with an Interaction Data Reload action
  4. Element receives onInteractionDataReload and reads updated data via getInteraction()
// Listen for workflow results before triggering
const unsubscribe = api.onInteractionDataReload(async (interactionId) => {
  const updated = await api.getInteraction({ interactionId });
  console.log("Workflow result:", updated.metadata);
});

// Trigger the workflow
await api.triggerWorkflow({
  workflowId: "wf-refund-process",
  inputData: { orderId: "ORD-123", amount: 49.99 },
});

Notes:

  • Any workflow can be triggered — no tagging or pre-registration in IEF is required
  • Rate limiting and permissions are enforced by the workflow engine, not by IEF
  • Error handling: if the workflow cannot be started (invalid ID, parameters, or permissions), the promise rejects with a structured error

API Families

The ElementAPI methods and event subscriptions are organized into API families.
The generated API reference below is grouped by these same families:

FamilyWhat it covers
Interaction APIInteraction lifecycle — get/create/update/end interactions, voice controls (hold, mute, resume), transfers (blind, single-step, consult, attended, conference), workflow triggering, desktop navigation, and interaction event subscriptions
Media APIChannel-specific capabilities — dialpad/DTMF, rich media and chat messages, feed input, and feed-message events
Agent APIAgent presence and status — get/set agent state, user info, queues, reason codes, and agent-state event subscriptions
Admin APIEnvironment and configuration data — element config, users, and transfer queue lookups
Inter-Element CommunicationCross-element messaging routed through the host (send/receive)
AuthenticationAvaya JWT retrieval and refresh helpers
EventsError event subscription
LifecycleResource cleanup (destroy)

Development

# Install dependencies
npm install

# Build the library
npm run build

# Run tests
npm test

# Watch mode for tests
npm run test:watch

# Generate documentation
npm run docs

# Lint
npm run lint

License

This package is proprietary and licensed under the Avaya SDK License Agreement.
Use is subject to that agreement — see the LICENSE file included in this package and the
Avaya SDK License Agreement.
It is not open-source software.

Related Packages

API Documentation

DialpadDigit

Defined in: api/ElementAPI.ts:84

DTMF dialpad digits (0-9) for sending tones during calls

Example

import { DialpadDigit } from '@avaya/infinity-elements-api';

await api.sendDialpadDigit(DialpadDigit.Five, null, false);

ElementAPI

Defined in: api/ElementAPI.ts:694

ElementAPI - Main API for web components to interact with the Infinity Extensibility Framework

This is the primary interface that elements use to communicate with core-agent-ui.
Uses window.postMessage for API requests/responses and events.

Sandboxed Iframe Environment

IMPORTANT: Elements run in sandboxed iframes using srcdoc, which means:

  • window.location.origin returns "null" (the literal string "null")
  • document.referrer may be empty
  • Direct access to parent window properties is blocked
  • BroadcastChannel doesn't work (requires valid origin for message scoping)

All communication with the host (core-agent-ui) must go through window.postMessage.
The host has a valid origin and can make HTTP requests, handle OAuth, etc.

Examples

import { ElementAPI } from '@avaya/infinity-elements-api';

const api = new ElementAPI({
  elementId: 'my-element',
  timeout: 5000,
  debug: true
});
const userInfo = await api.getUserInfo();
console.log('Agent name:', userInfo.firstName, userInfo.lastName);
console.log('Email:', userInfo.email);
api.onInteractionAccepted((interactionId) => {
  console.log('Interaction accepted:', interactionId);
});

api.onInteractionEnded((interactionId) => {
  console.log('Interaction ended:', interactionId);
});

Extends

Constructors

Constructor

new ElementAPI(options: ElementAPIOptions): ElementAPI;

Defined in: api/ElementAPI.ts:728

Creates a new ElementAPI instance

Parameters
ParameterType
optionsElementAPIOptions
Returns

ElementAPI

Example
const api = new ElementAPI({
  elementId: 'my-custom-element',
  timeout: 10000,
  debug: true
});
Overrides

ElementAPIEvents.constructor

Methods

Interaction API

getInteraction()
getInteraction(options?: InteractionContextOptions): Promise<InteractionInfo>;

Defined in: api/ElementAPI.ts:822

Get information about the current active interaction

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<InteractionInfo>

Promise resolving to the interaction information

Throws

Error if no active interaction exists

Examples
try {
  const interaction = await api.getInteraction();
  console.log('Interaction ID:', interaction.interactionId);
  console.log('Customer:', interaction.customer?.name);
  console.log('Status:', interaction.status);
} catch (error) {
  console.error('No active interaction');
}
const interaction = await api.getInteraction({ interactionId: 'int-123' });
console.log('Status:', interaction.status);
getUserInteractions()
getUserInteractions(params?: GetUserInteractionsParams): Promise<GetUserInteractionsResponse>;

Defined in: api/ElementAPI.ts:929

Get user interactions including owned and viewing interactions

Retrieves all active interactions for the current or specified user,
including interactions they own and ones they are viewing.
Optionally includes queue and user details.

Parameters
ParameterTypeDescription
params?GetUserInteractionsParamsOptional parameters
Returns

Promise<GetUserInteractionsResponse>

Promise resolving to user interactions data

Examples
// Get current user's interactions with full details
const result = await api.getUserInteractions({ details: true });
console.log('Owned interactions:', result.interactions);
console.log('Viewing interactions:', result.viewing);
console.log('Logged in queues:', result.queue.loggedIn);
// Get interactions without queue/user details for better performance
const result = await api.getUserInteractions({ details: false });
const totalCount = result.interactions.length + result.viewing.length;
console.log('Total active interactions:', totalCount);
viewerRemoveInteraction()
viewerRemoveInteraction(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1016

Remove the current interaction from the viewer

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
await api.viewerRemoveInteraction();
await api.viewerRemoveInteraction({ interactionId: 'int-123' });
endInteraction()
endInteraction(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1046

End the current interaction

Terminates the active interaction and disconnects the call.

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
await api.endInteraction();
console.log('Interaction ended');
await api.endInteraction({ interactionId: 'int-123' });
startVoiceCall()
startVoiceCall(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1073

Start a voice call for the current interaction

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
await api.startVoiceCall();
await api.startVoiceCall({ interactionId: 'int-123' });
createVoiceInteraction()
createVoiceInteraction(params: CreateVoiceInteractionParams): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1100

Create a new voice interaction with a Queue ID and Phone Number

Creates a new outbound voice call interaction to the specified phone number
and assigns it to the specified queue.

Parameters
ParameterTypeDescription
paramsCreateVoiceInteractionParamsVoice interaction parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Example
await api.createVoiceInteraction({
  phoneNumber: '+1234567890',
  queueId: '003'
});
createInteraction()
createInteraction(options: CreateInteractionOptions): Promise<{
  interactionId: string;
}>;

Defined in: api/ElementAPI.ts:1144

Entry point for all outbound channel creation — email, SMS, chat, task, voice.

Generic replacement for channel-specific creation methods.
The Agent UI validates the request, opens the appropriate composition window
pre-populated with the provided values, and returns the new interaction ID.

createVoiceInteraction() remains available as a thin wrapper and is not deprecated.
No new channel-specific methods will be added — use commType instead.

Parameters
ParameterTypeDescription
optionsCreateInteractionOptionsChannel type, recipient, and content parameters
Returns

Promise<{
interactionId: string;
}>

Object containing the newly created interaction ID

Throws

INVALID_COMM_TYPE if commType is not a supported value

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Examples
const { interactionId } = await api.createInteraction({
  commType: "email",
  to: "[email protected]",
  subject: "Follow-up",
  body: "Dear customer...",
});
const { interactionId } = await api.createInteraction({
  commType: "task",
  subject: "Follow-up callback",
  navigateTo: false,
});
triggerWorkflow()
triggerWorkflow(params: TriggerWorkflowParams): Promise<TriggerWorkflowResponse>;

Defined in: api/ElementAPI.ts:1212

Trigger an AXP workflow by ID.

Wraps the platform startWorkflowSession API. The host (agent UI) executes
the actual call so credentials are never exposed to the element. When
interactionId is omitted the host automatically attaches the current
interaction context.

Workflow → element communication pattern:
Results flow back through the interaction object rather than a direct return
channel. The workflow performs an Update Interaction action with the result
data, then an Interaction Data Reload action. The element receives the update
via onInteractionDataReload
and reads the updated data via getInteraction.

Rate limiting and permissions are enforced by the workflow engine, not by IEF.

Parameters
ParameterTypeDescription
paramsTriggerWorkflowParamsWorkflow trigger parameters
Returns

Promise<TriggerWorkflowResponse>

Confirmation with the workflow session ID

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved (provide via params or navigate to an interaction)

Throws

MISSING_REQUIRED_PARAMS if workflowId is not provided

Throws

Error if the workflow engine rejects the request (invalid ID, invalid parameters, permissions, or network failure)

Examples
const result = await api.triggerWorkflow({
  workflowId: 'wf-refund-process',
});
console.log('Workflow started:', result.workflowSessionId);
const result = await api.triggerWorkflow({
  workflowId: 'wf-crm-update',
  inputData: { orderId: 'ORD-123', amount: 49.99 },
});
// 1. Listen for workflow results before triggering
api.onInteractionDataReload(async (interactionId) => {
  const updated = await api.getInteraction({ interactionId });
  console.log('Workflow result:', updated.metadata);
});

// 2. Trigger the workflow
await api.triggerWorkflow({
  workflowId: 'wf-refund-process',
  inputData: { orderId: 'ORD-123', amount: 49.99 },
});
navigateTo()
navigateTo(to: string, options?: NavigateToOptions): Promise<NavigateToResponse>;

Defined in: api/ElementAPI.ts:1294

Navigate the agent desktop to a different view inside the agent app.

The element passes a fully-resolved relative URL as to; the host
validates the URL shape and consults a host-side blacklist before
forwarding to react-router. Because react-router is scoped to the agent
app's basename (/app/agent/), only paths inside the agent app are
reachable — external URLs, protocol-relative URLs, and javascript: /
data: schemes are rejected at the validator.

Signature mirrors react-router's navigate(to, options?) so partners
already familiar with react-router get the shape they expect.

Requirements: This method is part of the Infinity Extensibility
Framework and requires the fg_infinity_extensibility_framework feature
flag to be enabled in the agent desktop. When disabled, infinity elements
cannot load so this API is not available.

Parameters
ParameterTypeDescription
tostringRelative path to navigate to (e.g. /interactions/abc/feed)
options?NavigateToOptionsReserved per-call options (replace, state); see NavigateToOptions. None are honored by the host in API v1.
Returns

Promise<NavigateToResponse>

Navigation confirmation with the resulting path

Throws

Error if the Infinity Extensibility Framework is not enabled (elements won't load)

Throws

NAVIGATION_BLOCKED if the URL is malformed, external, traverses paths, or is host-blacklisted

Throws

NAVIGATION_FAILED if navigation could not be completed

Examples
await api.navigateTo("/interactions");
await api.navigateTo(`/interactions/${interactionId}/profile`);
await api.navigateTo(
  `/interactions/${interactionId}/email/${messageId}/reply`,
);
await api.navigateTo(
  `/interactions/${interactionId}/custom-tab/${tabId}`,
);
await api.navigateTo("/interactions", { replace: true });

Scope & Limits (API v1)

  • External URLs: Not allowed. to must be a relative path starting
    with / (and not //); render external content inside your own iframe.
  • Path traversal & unsafe characters: Rejected by the host validator.
    Each path segment must contain at least one alphanumeric character and
    only use [a-zA-Z0-9._-].
  • Length cap: to is capped at 200 characters.
  • Semantics: Imperative — the agent cannot opt out; navigation runs
    immediately after the host validates the URL.
  • Admin gating: None in API v1. Any Element loaded under the IEF
    feature flag may call navigateTo. Runtime safeguards: rate limit
    (10 req/sec/source), URL shape validator, host-side blacklist.
  • Multi-panel: Route-level. The whole agent-desktop view changes; the
    active interaction is not disrupted (voice/audio and per-interaction
    state are independent of the routed view).
holdInteraction()
holdInteraction(interactionId: string): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1324

Places an active voice interaction on hold.

The customer hears hold music (if configured by the tenant).
The agent desktop reflects the "On Hold" state once the backend confirms.

Parameters
ParameterTypeDescription
interactionIdstringThe voice interaction to place on hold
Returns

Promise<{
message: string;
}>

Confirmation message on success

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved

Throws

HOLD_MUTE_VOICE_ONLY if the interaction is not a voice channel

Throws

INTERACTION_NOT_CONNECTED if the interaction is not in connected state

Throws

INTERACTION_ALREADY_ON_HOLD if the interaction is already on hold

Example
await api.holdInteraction("interaction-id-123");
resumeInteraction()
resumeInteraction(interactionId: string): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1348

Resumes a voice interaction from hold, restoring audio between agent and customer.

Counterpart to holdInteraction().

Parameters
ParameterTypeDescription
interactionIdstringThe voice interaction to resume
Returns

Promise<{
message: string;
}>

Confirmation message on success

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved

Throws

HOLD_MUTE_VOICE_ONLY if the interaction is not a voice channel

Throws

INTERACTION_NOT_ON_HOLD if the interaction is not currently on hold

Example
await api.resumeInteraction("interaction-id-123");
muteInteraction()
muteInteraction(interactionId: string): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1373

Mutes the agent's microphone during an active voice interaction.

The customer can no longer hear the agent. The agent can still hear the customer.

Parameters
ParameterTypeDescription
interactionIdstringThe voice interaction to mute
Returns

Promise<{
message: string;
}>

Confirmation message on success

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved

Throws

HOLD_MUTE_VOICE_ONLY if the interaction is not a voice channel

Throws

INTERACTION_NOT_CONNECTED if the interaction is not in connected state

Throws

ALREADY_MUTED if the microphone is already muted

Example
await api.muteInteraction("interaction-id-123");
unmuteInteraction()
unmuteInteraction(interactionId: string): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1397

Restores the agent's microphone during an active voice interaction.

Counterpart to muteInteraction().

Parameters
ParameterTypeDescription
interactionIdstringThe voice interaction to unmute
Returns

Promise<{
message: string;
}>

Confirmation message on success

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved

Throws

HOLD_MUTE_VOICE_ONLY if the interaction is not a voice channel

Throws

NOT_MUTED if the microphone is not currently muted

Example
await api.unmuteInteraction("interaction-id-123");
wrapUpInteraction()
wrapUpInteraction(interactionId: string, options: WrapUpInteractionOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1427

Wraps up a completed interaction with a disposition code.

Applies the disposition code and notes, then removes the interaction from
the agent desktop. The interaction must no longer be in "Connected" state —
call this after the customer has disconnected or the agent has ended the call.

Parameters
ParameterTypeDescription
interactionIdstringThe interaction to wrap up
optionsWrapUpInteractionOptionsDisposition code and optional notes
Returns

Promise<{
message: string;
}>

Confirmation message on success

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved

Throws

INTERACTION_STILL_ACTIVE if the interaction is still in connected state

Throws

INVALID_DISPOSITION_CODE if the disposition code is not in the configured list

Example
await api.wrapUpInteraction("interaction-id-123", {
  dispositionCode: "Resolved",
  notes: "Customer issue resolved",
});
closeUnresolved()
closeUnresolved(interactionId: string): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1455

Parks an interaction without marking it as complete.

Removes the interaction from the agent's active list. The interaction
returns to the queue or remains available for re-assignment. No
disposition code is required.

Parameters
ParameterTypeDescription
interactionIdstringThe interaction to park
Returns

Promise<{
message: string;
}>

Confirmation message on success

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved

Example
await api.closeUnresolved("interaction-id-123");
updateInteraction()
updateInteraction(interactionId: string | undefined, fields: UpdateInteractionFields): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1496

Updates mutable fields on an active interaction.

Writes any combination of customer details (name, phone, email) and interaction
metadata (subject, body, notes, interactionType, endResult, routingPhone,
routingPhoneName, customerLanguageCode, fields). At least one field must be
provided. After a successful update the host broadcasts an onInteractionDataReload
event so all listening Elements can refresh their view.

Note: a single updateInteraction() call fires onInteractionDataReload twice in
immediate succession — consumers should debounce that event handler.

Parameters
ParameterTypeDescription
interactionIdstring | undefinedThe interaction to update (optional — uses current context if omitted)
fieldsUpdateInteractionFieldsFields to update; at least one must be set
Returns

Promise<{
message: string;
}>

Confirmation message on success

Throws

AGENT_NOT_LOGGED_IN if the agent is not in CX logged-in state

Throws

NO_INTERACTION_ID if no interaction ID can be resolved

Throws

NO_FIELDS_TO_UPDATE if all fields are omitted

Throws

ROUTING_PHONE_NAME_REQUIRED if routingPhone is provided without routingPhoneName

Example
await api.updateInteraction("interaction-id-123", {
  name: "Jane Smith",
  subject: "Billing enquiry",
  notes: "Customer called about invoice #42",
  routingPhone: "+1-555-0200",
  routingPhoneName: "Main Queue",
  customerLanguageCode: "fr-FR",
});
completeBlindTransfer()
completeBlindTransfer(options: BlindTransferOptions): Promise<boolean>;

Defined in: api/ElementAPI.ts:1526

Complete a blind transfer

Transfers the call to another agent or number without consultation.

Parameters
ParameterTypeDescription
optionsBlindTransferOptionsTransfer configuration
Returns

Promise<boolean>

Promise resolving to true if successful

Example
const interaction = await api.getInteraction();
await api.completeBlindTransfer({
  interactionId: interaction.interactionId,
  transferTo: '[email protected]',
  transferToName: 'John Doe',
  transferCallerIdType: 'internal'
});
singleStepTransfer()
singleStepTransfer(params: SingleStepTransferParams): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1547

Perform a single-step transfer

Transfers the interaction directly to the specified target.

Parameters
ParameterTypeDescription
paramsSingleStepTransferParamsTransfer parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Example
await api.singleStepTransfer({
  targetId: 'user123',
  targetName: 'Support Team'
});
consultCall()
consultCall(options: ConsultCallOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1595

Initiate a consult call

Starts a consultation with another agent, phone number, or queue while keeping
the original caller on hold.

Parameters
ParameterTypeDescription
optionsConsultCallOptionsConsult call configuration
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
const interaction = await api.getInteraction();
await api.consultCall({
  interactionId: interaction.interactionId,
  transferTo: '[email protected]'
});
await api.consultCall({
  interactionId: interaction.interactionId,
  phoneNumber: '+1234567890'
});
// Get available queues first
const queues = await api.getTransferQueuesInteraction();
const targetQueue = queues.find(q => q.name === 'Support Queue');

await api.consultCall({
  interactionId: interaction.interactionId,
  queueId: targetQueue.id
});
transferInteraction()
transferInteraction(options: TransferInteractionOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1638

Generic transfer entry point for all channels — blind for all, consult for voice only.

Transfers an interaction to an agent, queue, or external address.
Digital interactions (email, SMS, chat, task) support blind transfer only.
Voice interactions additionally support consult (attended) transfer.

For consult transfers, this method only initiates the consult — the customer is placed
on hold and the agent is connected to the target. Use completeAttendedTransfer() or
attendedTransferCancel() to complete or cancel the transfer.

Parameters
ParameterTypeDescription
optionsTransferInteractionOptionsTransfer parameters including target and transfer type
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Throws

CONSULT_NOT_SUPPORTED if transferType is "consult" on a non-voice interaction

Throws

INVALID_TRANSFER_TARGET if the target user or queue does not exist or is disabled

Examples
await api.transferInteraction({
  interactionId: 'int-123',
  targetId: '[email protected]',
  targetName: 'Support Agent',
  transferType: 'blind',
});
await api.transferInteraction({
  interactionId: 'int-123',
  targetId: '[email protected]',
  targetName: 'Supervisor',
  transferType: 'consult',
});
// Then complete or cancel:
await api.completeAttendedTransfer({ interactionId: 'int-123' });
completeAttendedTransfer()
completeAttendedTransfer(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1668

Complete an attended transfer

Finalizes the attended transfer after consulting with the target party.

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
// After consulting
await api.completeAttendedTransfer();
await api.completeAttendedTransfer({ interactionId: 'int-123' });
completeConference()
completeConference(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1698

Complete the interaction as a conference

Merges all parties into a conference call instead of completing a transfer.

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
// After consulting
await api.completeConference();
await api.completeConference({ interactionId: 'int-123' });
attendedTransferWarm()
attendedTransferWarm(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1727

Perform a warm attended transfer

Introduces the caller to the transfer target before completing the transfer.

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
await api.attendedTransferWarm();
await api.attendedTransferWarm({ interactionId: 'int-123' });
attendedTransferCancel()
attendedTransferCancel(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1756

Cancel an attended transfer

Cancels the ongoing attended transfer and returns to the original call.

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
await api.attendedTransferCancel();
await api.attendedTransferCancel({ interactionId: 'int-123' });
acceptInteraction()
acceptInteraction(options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1790

Accept an incoming interaction

Accepts a queued or alerting interaction.

Parameters
ParameterTypeDescription
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
api.onInteractionAccepted(async (interactionId) => {
  console.log('New interaction:', interactionId);
});

// When ready to accept
await api.acceptInteraction();
await api.acceptInteraction({ interactionId: 'int-123' });
onInteractionStatusChanged()
onInteractionStatusChanged(callback: InteractionStatusChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:418

Subscribe to interaction status changes

Fires when the status of an interaction changes (e.g., alerting, connected, held)

Parameters
ParameterTypeDescription
callbackInteractionStatusChangedCallbackFunction to call when interaction status changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
const unsubscribe = api.onInteractionStatusChanged(({ interactionId, status }) => {
  console.log(`Interaction ${interactionId} status changed to ${status}`);
});

// Later, to unsubscribe:
unsubscribe();
Inherited from

ElementAPIEvents.onInteractionStatusChanged

onInteractionAccepted()
onInteractionAccepted(callback: InteractionAcceptedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:442

Subscribe to interaction accepted events

Fires when an agent accepts an incoming interaction

Parameters
ParameterTypeDescription
callbackInteractionAcceptedCallbackFunction to call when an interaction is accepted
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionAccepted((interactionId) => {
  console.log('Accepted interaction:', interactionId);
  // Load customer data, show interaction UI, etc.
});
Inherited from

ElementAPIEvents.onInteractionAccepted

onInteractionEnded()
onInteractionEnded(callback: InteractionEndedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:464

Subscribe to interaction ended events

Fires when an interaction is ended or disconnected

Parameters
ParameterTypeDescription
callbackInteractionEndedCallbackFunction to call when an interaction ends
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionEnded((interactionId) => {
  console.log('Interaction ended:', interactionId);
  // Clean up UI, save data, etc.
});
Inherited from

ElementAPIEvents.onInteractionEnded

onInteractionUpdated()
onInteractionUpdated(callback: InteractionUpdatedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:486

Subscribe to interaction updated events

Fires when an interaction is updated with new information

Parameters
ParameterTypeDescription
callbackInteractionUpdatedCallbackFunction to call when an interaction is updated
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionUpdated(({ interactionId, payload }) => {
  console.log('Interaction updated:', interactionId);
  console.log('New data:', payload);
});
Inherited from

ElementAPIEvents.onInteractionUpdated

onInteractionDataReload()
onInteractionDataReload(callback: InteractionDataReloadCallback): () => void;

Defined in: api/ElementAPIEvents.ts:511

Subscribe to interaction data reload events.

Fires after a successful updateInteraction() call, signalling the element
to refresh its local copy of the interaction data from its own backend or
re-fetch fields it cares about.

Parameters
ParameterTypeDescription
callbackInteractionDataReloadCallbackFunction to call when the interaction data should be reloaded
Returns

Unsubscribe function

(): void;
Returns

void

Example
const unsubscribe = api.onInteractionDataReload((interactionId) => {
  console.log('Reload data for:', interactionId);
  // Re-fetch interaction details from your backend
});
Inherited from

ElementAPIEvents.onInteractionDataReload

onConsultStatusChanged()
onConsultStatusChanged(callback: ConsultStatusChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:532

Subscribe to consult status changes

Fires when the status of a consultation changes

Parameters
ParameterTypeDescription
callbackConsultStatusChangedCallbackFunction to call when consult status changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onConsultStatusChanged(({ interactionId, consultStatus, consultParty }) => {
  console.log(`Consult ${consultStatus} with ${consultParty}`);
});
Inherited from

ElementAPIEvents.onConsultStatusChanged

onCompleteAsConference()
onCompleteAsConference(callback: CompleteAsConferenceCallback): () => void;

Defined in: api/ElementAPIEvents.ts:553

Subscribe to complete as conference events

Fires when an interaction is completed as a conference

Parameters
ParameterTypeDescription
callbackCompleteAsConferenceCallbackFunction to call when an interaction is completed as a conference
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onCompleteAsConference(({ interactionId }) => {
  console.log(`Interaction ${interactionId} completed as conference`);
});
Inherited from

ElementAPIEvents.onCompleteAsConference

onInteractionFocusChanged()
onInteractionFocusChanged(callback: InteractionFocusChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:678

Subscribe to interaction focus changed events.

Fires when the agent switches to a different interaction tab,
delivering the focused interactionId. Fires with null when the
agent navigates away from all interactions (e.g. Home, Analytics).

Also fires on email and SMS interaction accept even when createInteraction()
was called with navigateTo: false — digital channel accept always triggers
a focus change regardless of the navigateTo flag.

App-level elements should store the received interactionId and pass
it explicitly to getInteraction({interactionId}) to avoid relying
on URL context.

Parameters
ParameterTypeDescription
callbackInteractionFocusChangedCallbackFunction to call when the focused interaction changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionFocusChanged((interactionId) => {
  if (!interactionId) return;
  api.getInteraction({ interactionId }).then(data => render(data));
});
Inherited from

ElementAPIEvents.onInteractionFocusChanged

Media API

sendDialpadDigit()
sendDialpadDigit(
   digit: DialpadDigit, 
   audioOutputDeviceId: string | null, 
   noSendDialTone: boolean, 
   audioContextOverride?: "none" | "standard" | "webkit", 
   options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1833

Send a DTMF dialpad digit during a call

Parameters
ParameterTypeDescription
digitDialpadDigitThe dialpad digit to send (0-9)
audioOutputDeviceIdstring | nullAudio output device ID or null for default
noSendDialTonebooleanWhether to suppress the dial tone sound
audioContextOverride?"none" | "standard" | "webkit"Audio context type override
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
import { DialpadDigit } from '@avaya/infinity-elements-api';

await api.sendDialpadDigit(
  DialpadDigit.One,
  null,
  false
);
await api.sendDialpadDigit(
  DialpadDigit.One,
  null,
  false,
  undefined,
  { interactionId: 'int-123' }
);
insertTextIntoFeedInput()
insertTextIntoFeedInput(text: string, options?: InteractionContextOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1868

Insert text into the chat feed input field

Parameters
ParameterTypeDescription
textstringThe text to insert
options?InteractionContextOptionsOptional parameters
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
await api.insertTextIntoFeedInput('Hello, how can I help you today?');
await api.insertTextIntoFeedInput('Hello!', { interactionId: 'int-123' });
sendRichMediaMessage()
sendRichMediaMessage(options: SendRichMediaMessageOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:1910

Send a rich media message (image, file, etc.) to the interaction

Parameters
ParameterTypeDescription
optionsSendRichMediaMessageOptionsMessage options (must provide either mediaUrl or file)
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Deprecated

This method is deprecated and will be removed in a future version.

Examples
await api.sendRichMediaMessage({
  name: 'Product Image',
  mediaUrl: 'https://example.com/image.jpg',
  text: 'Here is the product you requested'
});
const fileInput = document.querySelector('input[type="file"]');
const file = fileInput.files[0];

await api.sendRichMediaMessage({
  name: 'Document',
  file: file,
  text: 'Attached document',
  interactionId: 'int-123'
});
sendChatMessage()
sendChatMessage(options: SendChatMessageOptions): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:2008

Send a chat message to the interaction

Supports sending text messages, media from URLs, or file uploads.
At least one of text, mediaUrl, or file must be provided.

Parameters
ParameterTypeDescription
optionsSendChatMessageOptionsMessage options (must provide interactionId and at least one of text, mediaUrl, or file)
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
await api.sendChatMessage({
  interactionId: 'int-123',
  text: 'Hello, how can I help you today?'
});
await api.sendChatMessage({
  interactionId: 'int-123',
  text: 'VIP customer — 3 open cases in CRM',
  type: 'private'
});
await api.sendChatMessage({
  interactionId: 'int-123',
  text: 'Suggested response: "I can help you with that refund."',
  type: 'agentAssist'
});
await api.sendChatMessage({
  interactionId: 'int-123',
  mediaUrl: 'https://example.com/image.jpg',
  text: 'Here is the product you requested'
});
const fileInput = document.querySelector('input[type="file"]');
const file = fileInput.files[0];

await api.sendChatMessage({
  interactionId: 'int-123',
  file: file,
  text: 'Attached document'
});
await api.sendChatMessage({
  interactionId: 'int-123',
  text: 'Please review this document',
  file: documentFile,
  fileName: 'Important Document.pdf'
});
onReceivedFeedMessage()
onReceivedFeedMessage(callback: FeedMessageCallback): () => void;

Defined in: api/ElementAPIEvents.ts:575

Subscribe to feed messages

Fires when a new message is received in the interaction feed

Parameters
ParameterTypeDescription
callbackFeedMessageCallbackFunction to call when a feed message is received. Receives (message: Message, interactionId?: string)
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onReceivedFeedMessage((message, interactionId) => {
  console.log('New message:', message.text, 'for interaction:', interactionId);
});
Inherited from

ElementAPIEvents.onReceivedFeedMessage

Agent API

getUserInfo()
getUserInfo(): Promise<UserInfo>;

Defined in: api/ElementAPI.ts:845

Get information about the current logged-in user/agent

Returns

Promise<UserInfo>

Promise resolving to the user information including agent status, queues, and profile

Example
const userInfo = await api.getUserInfo();
console.log('Agent:', userInfo.firstName, userInfo.lastName);
console.log('Queues:', userInfo.queues);
console.log('Email:', userInfo.email);
getAgentState()
getAgentState(): Promise<GetAgentStateResponse>;

Defined in: api/ElementAPI.ts:856

Get current agent state from the Agent Desktop cache (RTK / active user).
Does not call the backend; safe to call on element load before any agent-state-changed event.

Returns

Promise<GetAgentStateResponse>

Promise resolving to availability, CX login (isAID), agent id, queues with login flags, etc.

setAgentStatus()
setAgentStatus(
   userId: string, 
   status: AgentStatus, 
   reason?: {
  id: string;
  name: string;
}): Promise<{
  message: string;
}>;

Defined in: api/ElementAPI.ts:2062

Set the agent's status (Available, Away, Busy, etc.)

Parameters
ParameterTypeDescription
userIdstringThe user ID of the agent
statusAgentStatusThe new agent status
reason?{ id: string; name: string; }Optional reason for the status change (required for some statuses)
reason.id?string-
reason.name?string-
Returns

Promise<{
message: string;
}>

Promise resolving to a success message

Examples
const userInfo = await api.getUserInfo();
await api.setAgentStatus(userInfo.userId, { id: 'available', name: 'Available', category: 'available' });
const userInfo = await api.getUserInfo();
await api.setAgentStatus(userInfo.userId, { id: 'away', name: 'Away', category: 'away' }, {
  id: 'lunch',
  name: 'Lunch Break'
});
getUserQueues()
getUserQueues(params?: {
  filter?: string;
}): Promise<UserQueueInfo[]>;

Defined in: api/ElementAPI.ts:2092

Get all queues available to the current user (App Level)

Returns a basic list of queues the agent has access to.

Parameters
ParameterTypeDescription
params?{ filter?: string; }Optional filter parameters
params.filter?string-
Returns

Promise<UserQueueInfo[]>

Promise resolving to array of user queue information

Example
const queues = await api.getUserQueues();
console.log('Available queues:', queues.map(q => q.name));

// With filter
const salesQueues = await api.getUserQueues({ filter: 'Sales' });
getReasonCodes()
getReasonCodes(params?: GetReasonCodesParams): Promise<GetReasonCodesResponse>;

Defined in: api/ElementAPI.ts:2190

Get reason codes for agent status changes

Returns available reason codes that can be used when changing agent status.

Parameters
ParameterTypeDescription
params?GetReasonCodesParamsOptional parameters
Returns

Promise<GetReasonCodesResponse>

Promise resolving to reason codes response

Examples
const response = await api.getReasonCodes();
console.log('Reason codes:', response.reasons);
const response = await api.getReasonCodes({ type: 'away' });
const awayReasons = response.reasons;
onChangedAgentState()
onChangedAgentState(callback: AgentStateChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:623

Parameters
ParameterType
callbackAgentStateChangedCallback
Returns
(): void;
Returns

void

Deprecated

Use onAgentStateChange instead for the full structured payload

Inherited from

ElementAPIEvents.onChangedAgentState

onAgentStateChange()
onAgentStateChange(callback: AgentStateChangeCallback): () => void;

Defined in: api/ElementAPIEvents.ts:646

Subscribe to agent state changed events

Fires when the agent's state changes (e.g. availability, CX login/logout, queue login/logout).
Supersedes onChangedAgentState with a fully structured payload including
isAID, queues, agentState, timestamp, agentId, and reasonCode.

Parameters
ParameterTypeDescription
callbackAgentStateChangeCallbackFunction to call when agent state changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
const unsubscribe = api.onAgentStateChange(({ agentState, isAID, queues }) => {
  console.log(`State: ${agentState}, CX logged in: ${isAID}`);
});
Inherited from

ElementAPIEvents.onAgentStateChange

Admin API

getConfig()
getConfig(): Promise<IEFConfig>;

Defined in: api/ElementAPI.ts:895

Get a snapshot of the element's IEF context — the interaction that
spawned it (if any), the current user id, the workflow session's
engagement id (if active), and the user's CRM configuration.

Safe to call as soon as the element loads — no event waiting required.
Returns a point-in-time snapshot; does not subscribe to updates.

The returned object is expandable — future releases may add new
properties without breaking existing consumers. Read by property name
rather than destructuring against a fixed key set.

Returns

Promise<IEFConfig>

Promise resolving to the IEF context snapshot

Example
const config = await api.getConfig();

// Identity — who the agent is and which customer session this belongs to
console.log('Agent:', config.userId);
console.log('Session:', config.engagementId);

// Interaction context — which interaction spawned this element
if (config.originalInteraction) {
  console.log('Channel:', config.originalInteraction.commType);
  console.log('Interaction ID:', config.originalInteraction.id);
}

// CRM-aware behaviour — act on admin-configured settings
if (config.crmConfig?.clickToDial) {
  enableClickToDial();
}
getUsers()
getUsers(params?: {
  interactionId?: string;
  filter?: string;
}): Promise<GetUsersResponse[]>;

Defined in: api/ElementAPI.ts:991

Get a list of users in Infinity

Returns users available for transfer or consult operations. Returns up to 100 users.

  • App Level (sidebar widgets): Provide interactionId parameter
  • Interaction Level (interaction widgets): Omit interactionId, uses interaction context automatically
Parameters
ParameterTypeDescription
params?{ interactionId?: string; filter?: string; }Optional parameters
params.interactionId?stringRequired for app-level widgets, optional for interaction-level widgets
params.filter?stringOptional substring search against user name fields
Returns

Promise<GetUsersResponse[]>

Promise resolving to array of user information

Examples
const users = await api.getUsers();
users.forEach(user => {
  console.log(`$USER.FULLNAME - ${user.cxStatus.status} - $USER.PRESENCE`);
});
const users = await api.getUsers({ filter: 'john' });
console.log('Found users:', users.map(u => u.fullName));
const users = await api.getUsers({ interactionId: 'int-123' });
users.forEach(user => {
  console.log(`$USER.FULLNAME - ${user.cxStatus.status} - $USER.PRESENCE`);
});
const users = await api.getUsers({
  interactionId: 'int-123',
  filter: 'john'
});
const users = await api.getUsers({ filter: searchInput });
const eligibleUsers = users.filter(u => u.eligible);
eligibleUsers.forEach(user => {
  console.log(`$USER.FULLNAME ($USER.EXTENSION) - ${user.cxStatus.status}`);
});
getTransferQueues()
getTransferQueues(params: {
  interactionId: string;
  filter?: string;
}): Promise<InteractionQueueInfo[]>;

Defined in: api/ElementAPI.ts:2119

Get transfer queues with real-time statistics (App Level)

Returns detailed queue information including waiting interactions, active agents,
and average wait times. Requires explicit interactionId since this is used at app level
where interaction context is not available.

Parameters
ParameterTypeDescription
params{ interactionId: string; filter?: string; }Required interactionId and optional filter parameters
params.interactionIdstring-
params.filter?string-
Returns

Promise<InteractionQueueInfo[]>

Promise resolving to array of queue information with statistics

Example
const queues = await api.getTransferQueues({
  interactionId: 'int-123',
  filter: 'support'
});
queues.forEach(queue => {
  console.log(`${queue.name}: ${queue.waitingInteractions} waiting`);
  console.log(`Active agents: ${queue.countActiveAgents}`);
});
getTransferQueuesInteraction()
getTransferQueuesInteraction(params?: {
  filter?: string;
  interactionId?: string;
}): Promise<InteractionQueueInfo[]>;

Defined in: api/ElementAPI.ts:2158

Get transfer queues with real-time statistics (Interaction Level)

Returns detailed queue information including waiting interactions, active agents,
and average wait times. Uses interaction context automatically for interaction-level widgets.

Parameters
ParameterTypeDescription
params?{ filter?: string; interactionId?: string; }Optional filter parameters
params.filter?stringOptional substring search against queue names
params.interactionId?stringOptional interaction ID (required for app-level widgets, auto-provided for interaction-level widgets)
Returns

Promise<InteractionQueueInfo[]>

Promise resolving to array of queue information with statistics

Examples
const queues = await api.getTransferQueuesInteraction({ filter: 'support' });
queues.forEach(queue => {
  console.log(`${queue.name}: ${queue.waitingInteractions} waiting`);
  console.log(`Active agents: ${queue.countActiveAgents}`);
});
const queues = await api.getTransferQueuesInteraction({
  filter: 'support',
  interactionId: 'int-123'
});

Inter-Element Communication

sendInterElementMessage()
sendInterElementMessage<T>(message: T): void;

Defined in: api/ElementAPI.ts:2725

Send a message to other elements via the host (parent window)

Messages are routed through the host application which acts as a broker,
relaying messages to all other element iframes. This approach works in
sandboxed iframes where BroadcastChannel is not available.

Type Parameters
Type ParameterDescription
TThe type of the message
Parameters
ParameterTypeDescription
messageTThe message to send (can be any serializable type)
Returns

void

Example
api.sendInterElementMessage({ type: 'my-event', payload: { key: 'value' } });
onInterElementMessage()
onInterElementMessage<T>(callback: (message: T) => void): () => void;

Defined in: api/ElementAPI.ts:2765

Subscribe to messages from other elements routed through the host

The host application receives inter-element messages and relays them to
all element iframes. This works in sandboxed iframes where BroadcastChannel
is not available.

Type Parameters
Type ParameterDescription
TThe expected type of messages
Parameters
ParameterTypeDescription
callback(message: T) => voidFunction called when a message is received
Returns

Unsubscribe function to stop listening

(): void;
Returns

void

Example
const unsubscribe = api.onInterElementMessage<MyMessageType>((message) => {
  console.log('Received:', message);
});

// Later, stop listening
unsubscribe();

Authentication

getAvayaJwt()
getAvayaJwt(options: {
  authorizationEndpoint?: string;
  tokenEndpoint?: string;
  clientId?: string;
  scopes?: string[];
  redirectUri?: string;
  popupOptions?: PopupOptions;
  forceRefresh?: boolean;
}): Promise<string>;

Defined in: api/ElementAPI.ts:2241

Get Avaya JWT token with multi-level request deduplication and automatic refresh

  • Returns cached token from localStorage if available and not expired
  • Automatically refreshes token if expired (using refresh token)
  • Prevents duplicate concurrent fetch requests (instance-level)
  • Prevents duplicate OAuth popups across iframes/elements (cross-iframe coordination)
  • Initiates Keycloak OAuth flow if no token exists

Cross-iframe coordination ensures that if 10 iframes all call getAvayaJwt(),
only ONE OAuth popup will appear, and all iframes will receive the same token.

Uses localStorage for coordination to ensure only one OAuth popup appears

GUARANTEE: This function ALWAYS either returns a JWT string or throws an error.
There are no code paths that return undefined or hang indefinitely.

Parameters
ParameterTypeDescription
options{ authorizationEndpoint?: string; tokenEndpoint?: string; clientId?: string; scopes?: string[]; redirectUri?: string; popupOptions?: PopupOptions; forceRefresh?: boolean; }Configuration options (all optional, uses defaults if not provided)
options.authorizationEndpoint?stringKeycloak authorization endpoint URL
options.tokenEndpoint?stringKeycloak token endpoint URL
options.clientId?stringOAuth client ID
options.scopes?string[]OAuth scopes to request
options.redirectUri?stringOAuth redirect URI (URL to redirect.html)
options.popupOptions?PopupOptionsPopup window size/position (defaults to 500x600)
options.forceRefresh?booleanForce token refresh even if not expired (defaults to false)
Returns

Promise<string>

Promise The JWT token (never returns undefined, always throws on error)

Example
// Use defaults
const jwt = await api.getAvayaJwt();

// With configuration
const jwt = await api.getAvayaJwt({
  authorizationEndpoint: 'https://keycloak.example.com/auth/realms/xxx/protocol/openid-connect/auth',
  tokenEndpoint: 'https://keycloak.example.com/auth/realms/xxx/protocol/openid-connect/token',
  clientId: 'my-client-id',
  redirectUri: 'https://myapp.com/redirect.html',
  forceRefresh: true
});
refreshToken()
refreshToken(options: {
  tokenEndpoint?: string;
  clientId?: string;
}): Promise<string>;

Defined in: api/ElementAPI.ts:2357

Refresh the access token using the stored refresh token

Parameters
ParameterTypeDescription
options{ tokenEndpoint?: string; clientId?: string; }Configuration options
options.tokenEndpoint?stringKeycloak token endpoint URL (required)
options.clientId?stringOAuth client ID (required)
Returns

Promise<string>

Promise The new JWT access token

Throws

Error if refresh token is not available or refresh fails

Example
try {
  const newJwt = await api.refreshToken({
    tokenEndpoint: 'https://keycloak.example.com/auth/realms/xxx/protocol/openid-connect/token',
    clientId: 'my-client-id'
  });
  console.log('Token refreshed successfully');
} catch (error) {
  console.error('Token refresh failed:', error);
  // May need to re-authenticate
}
clearAvayaJwt()
clearAvayaJwt(): void;

Defined in: api/ElementAPI.ts:2417

Clear the cached JWT token and force re-authentication on next getAvayaJwt call

Returns

void

Example
api.clearAvayaJwt();
const newJwt = await api.getAvayaJwt(); // Will trigger OAuth flow

Events

onError()
onError(callback: ErrorCallback): () => void;

Defined in: api/ElementAPIEvents.ts:597

Subscribe to error events

Fires when an error occurs in the API

Parameters
ParameterTypeDescription
callbackErrorCallbackFunction to call when an error occurs
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onError((error) => {
  console.error('API Error:', error.code, error.message);
  // Display error notification to user
});
Inherited from

ElementAPIEvents.onError

Lifecycle

destroy()
destroy(): void;

Defined in: api/ElementAPI.ts:770

Clean up resources when the React component is unmounted or no longer needed

Removes all event listeners, closes channels, and clears pending requests.
Call this method in your React component's cleanup/unmount lifecycle.

Returns

void

Example
// In a React component
useEffect(() => {
  const api = new ElementAPI();
  return () => {
    api.destroy(); // Cleanup on unmount
  };
}, []);

ElementAPIEvents

Defined in: api/ElementAPIEvents.ts:127

ElementAPIEvents - Base class providing event subscription and dispatch for ElementAPI

Owns all event listener Sets, provides on* subscription methods,
and dispatches incoming window messages to the appropriate listeners.
ElementAPI extends this class to inherit all event functionality.

Extended by

Constructors

Constructor

new ElementAPIEvents(): ElementAPIEvents;
Returns

ElementAPIEvents

Methods

Interaction API

onInteractionStatusChanged()
onInteractionStatusChanged(callback: InteractionStatusChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:418

Subscribe to interaction status changes

Fires when the status of an interaction changes (e.g., alerting, connected, held)

Parameters
ParameterTypeDescription
callbackInteractionStatusChangedCallbackFunction to call when interaction status changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
const unsubscribe = api.onInteractionStatusChanged(({ interactionId, status }) => {
  console.log(`Interaction ${interactionId} status changed to ${status}`);
});

// Later, to unsubscribe:
unsubscribe();
onInteractionAccepted()
onInteractionAccepted(callback: InteractionAcceptedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:442

Subscribe to interaction accepted events

Fires when an agent accepts an incoming interaction

Parameters
ParameterTypeDescription
callbackInteractionAcceptedCallbackFunction to call when an interaction is accepted
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionAccepted((interactionId) => {
  console.log('Accepted interaction:', interactionId);
  // Load customer data, show interaction UI, etc.
});
onInteractionEnded()
onInteractionEnded(callback: InteractionEndedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:464

Subscribe to interaction ended events

Fires when an interaction is ended or disconnected

Parameters
ParameterTypeDescription
callbackInteractionEndedCallbackFunction to call when an interaction ends
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionEnded((interactionId) => {
  console.log('Interaction ended:', interactionId);
  // Clean up UI, save data, etc.
});
onInteractionUpdated()
onInteractionUpdated(callback: InteractionUpdatedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:486

Subscribe to interaction updated events

Fires when an interaction is updated with new information

Parameters
ParameterTypeDescription
callbackInteractionUpdatedCallbackFunction to call when an interaction is updated
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionUpdated(({ interactionId, payload }) => {
  console.log('Interaction updated:', interactionId);
  console.log('New data:', payload);
});
onInteractionDataReload()
onInteractionDataReload(callback: InteractionDataReloadCallback): () => void;

Defined in: api/ElementAPIEvents.ts:511

Subscribe to interaction data reload events.

Fires after a successful updateInteraction() call, signalling the element
to refresh its local copy of the interaction data from its own backend or
re-fetch fields it cares about.

Parameters
ParameterTypeDescription
callbackInteractionDataReloadCallbackFunction to call when the interaction data should be reloaded
Returns

Unsubscribe function

(): void;
Returns

void

Example
const unsubscribe = api.onInteractionDataReload((interactionId) => {
  console.log('Reload data for:', interactionId);
  // Re-fetch interaction details from your backend
});
onConsultStatusChanged()
onConsultStatusChanged(callback: ConsultStatusChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:532

Subscribe to consult status changes

Fires when the status of a consultation changes

Parameters
ParameterTypeDescription
callbackConsultStatusChangedCallbackFunction to call when consult status changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onConsultStatusChanged(({ interactionId, consultStatus, consultParty }) => {
  console.log(`Consult ${consultStatus} with ${consultParty}`);
});
onCompleteAsConference()
onCompleteAsConference(callback: CompleteAsConferenceCallback): () => void;

Defined in: api/ElementAPIEvents.ts:553

Subscribe to complete as conference events

Fires when an interaction is completed as a conference

Parameters
ParameterTypeDescription
callbackCompleteAsConferenceCallbackFunction to call when an interaction is completed as a conference
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onCompleteAsConference(({ interactionId }) => {
  console.log(`Interaction ${interactionId} completed as conference`);
});
onInteractionFocusChanged()
onInteractionFocusChanged(callback: InteractionFocusChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:678

Subscribe to interaction focus changed events.

Fires when the agent switches to a different interaction tab,
delivering the focused interactionId. Fires with null when the
agent navigates away from all interactions (e.g. Home, Analytics).

Also fires on email and SMS interaction accept even when createInteraction()
was called with navigateTo: false — digital channel accept always triggers
a focus change regardless of the navigateTo flag.

App-level elements should store the received interactionId and pass
it explicitly to getInteraction({interactionId}) to avoid relying
on URL context.

Parameters
ParameterTypeDescription
callbackInteractionFocusChangedCallbackFunction to call when the focused interaction changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onInteractionFocusChanged((interactionId) => {
  if (!interactionId) return;
  api.getInteraction({ interactionId }).then(data => render(data));
});

Media API

onReceivedFeedMessage()
onReceivedFeedMessage(callback: FeedMessageCallback): () => void;

Defined in: api/ElementAPIEvents.ts:575

Subscribe to feed messages

Fires when a new message is received in the interaction feed

Parameters
ParameterTypeDescription
callbackFeedMessageCallbackFunction to call when a feed message is received. Receives (message: Message, interactionId?: string)
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onReceivedFeedMessage((message, interactionId) => {
  console.log('New message:', message.text, 'for interaction:', interactionId);
});

Agent API

onChangedAgentState()
onChangedAgentState(callback: AgentStateChangedCallback): () => void;

Defined in: api/ElementAPIEvents.ts:623

Parameters
ParameterType
callbackAgentStateChangedCallback
Returns
(): void;
Returns

void

Deprecated

Use onAgentStateChange instead for the full structured payload

onAgentStateChange()
onAgentStateChange(callback: AgentStateChangeCallback): () => void;

Defined in: api/ElementAPIEvents.ts:646

Subscribe to agent state changed events

Fires when the agent's state changes (e.g. availability, CX login/logout, queue login/logout).
Supersedes onChangedAgentState with a fully structured payload including
isAID, queues, agentState, timestamp, agentId, and reasonCode.

Parameters
ParameterTypeDescription
callbackAgentStateChangeCallbackFunction to call when agent state changes
Returns

Unsubscribe function

(): void;
Returns

void

Example
const unsubscribe = api.onAgentStateChange(({ agentState, isAID, queues }) => {
  console.log(`State: ${agentState}, CX logged in: ${isAID}`);
});

Events

onError()
onError(callback: ErrorCallback): () => void;

Defined in: api/ElementAPIEvents.ts:597

Subscribe to error events

Fires when an error occurs in the API

Parameters
ParameterTypeDescription
callbackErrorCallbackFunction to call when an error occurs
Returns

Unsubscribe function

(): void;
Returns

void

Example
api.onError((error) => {
  console.error('API Error:', error.code, error.message);
  // Display error notification to user
});

IframeSecurity

Defined in: security/IframeSecurity.ts:100

Static utility class for iframe security validation and monitoring.

Constructors

Constructor

new IframeSecurity(): IframeSecurity;
Returns

IframeSecurity

Methods

validateIframe()

static validateIframe(iframe: HTMLIFrameElement, options: IframeValidationOptions): IframeValidationResult;

Defined in: security/IframeSecurity.ts:104

Validates that an iframe element has the expected security configuration.

Parameters
ParameterType
iframeHTMLIFrameElement
optionsIframeValidationOptions
Returns

IframeValidationResult

monitorIframe()

static monitorIframe(iframe: HTMLIFrameElement, options: IframeMonitorOptions): () => void;

Defined in: security/IframeSecurity.ts:205

Monitors an iframe for changes to security-critical attributes.

Parameters
ParameterType
iframeHTMLIFrameElement
optionsIframeMonitorOptions
Returns
(): void;
Returns

void

validateParentOrigins()

static validateParentOrigins(allowedOrigins: string[]): IframeValidationResult;

Defined in: security/IframeSecurity.ts:248

Validates the current window's parent environment by checking ancestor origins.

Parameters
ParameterType
allowedOriginsstring[]
Returns

IframeValidationResult


InteractionInfo

Defined in: api/ElementAPI.ts:38

Properties

PropertyTypeDefined in
idstringapi/ElementAPI.ts:39
interactionIdstringapi/ElementAPI.ts:40
statusstringapi/ElementAPI.ts:41
commType?stringapi/ElementAPI.ts:42
direction?stringapi/ElementAPI.ts:43
customer?{ name?: string; number?: string; id?: string; }api/ElementAPI.ts:44
customer.name?stringapi/ElementAPI.ts:45
customer.number?stringapi/ElementAPI.ts:46
customer.id?stringapi/ElementAPI.ts:47
startTime?stringapi/ElementAPI.ts:49
duration?numberapi/ElementAPI.ts:50
metadata?Record<string, unknown>api/ElementAPI.ts:51

InteractionUpdatePayload

Defined in: api/ElementAPI.ts:54

Properties

PropertyTypeDefined in
idstringapi/ElementAPI.ts:55
status?stringapi/ElementAPI.ts:56
commType?stringapi/ElementAPI.ts:57
subCommType?stringapi/ElementAPI.ts:58
isAudio?booleanapi/ElementAPI.ts:59
isHold?booleanapi/ElementAPI.ts:60
isMute?booleanapi/ElementAPI.ts:61
details?{ notes?: string; subject?: string; }api/ElementAPI.ts:62
details.notes?stringapi/ElementAPI.ts:63
details.subject?stringapi/ElementAPI.ts:64
sourceDetails?{ phoneNumber?: string; email?: string; name?: string; }api/ElementAPI.ts:66
sourceDetails.phoneNumber?stringapi/ElementAPI.ts:67
sourceDetails.email?stringapi/ElementAPI.ts:68
sourceDetails.name?stringapi/ElementAPI.ts:69

BlindTransferOptions

Defined in: api/ElementAPI.ts:107

Properties

PropertyTypeDefined in
interactionIdstringapi/ElementAPI.ts:108
transferTostringapi/ElementAPI.ts:109
transferToNamestringapi/ElementAPI.ts:110
transferCallerIdType?stringapi/ElementAPI.ts:111

SingleStepTransferParams

Defined in: api/ElementAPI.ts:114

Properties

PropertyTypeDescriptionDefined in
targetIdstring-api/ElementAPI.ts:115
targetNamestring-api/ElementAPI.ts:116
interactionId?stringOptional interaction ID (required for app-level widgets, auto-provided for interaction-level widgets)api/ElementAPI.ts:118

CreateVoiceInteractionParams

Defined in: api/ElementAPI.ts:121

Properties

PropertyTypeDefined in
phoneNumberstringapi/ElementAPI.ts:122
queueIdstringapi/ElementAPI.ts:123

CreateInteractionOptions

Defined in: api/ElementAPI.ts:130

Options for creating a generic outbound interaction across any channel type.
Replaces channel-specific creation methods with a single unified API.

Properties

PropertyTypeDescriptionDefined in
commType"task" | "email" | "sms" | "chat" | "voice"Channel type for the new interactionapi/ElementAPI.ts:132
subCommType?stringOptional sub-type for further channel classification. Defaults per channel: voice → "outbound", email → "outbound", sms → "text", chat → "chat", task → "other". Omit to use the channel default. Passing an invalid value for the channel is rejected with a descriptive error listing the accepted values.api/ElementAPI.ts:139
to?stringRecipient — phone number for voice/SMS, email address for emailapi/ElementAPI.ts:141
queueId?stringQueue ID — required for voice; also needed for email/SMS to resolve the outbound addressapi/ElementAPI.ts:143
subject?stringSubject line for the interaction record. On email channel this populates details.subject only — it does NOT pre-populate the native Desktop email compose editor, which maintains a separate draft data model.api/ElementAPI.ts:149
body?stringBody content for the interaction record (email and SMS only; voice, chat, and task silently drop it). On email channel this populates details.body only — it does NOT pre-populate the native Desktop email compose editor, which maintains a separate draft data model. On SMS channel, body pre-populates the compose editor as a one-shot initial value, cleared after first use.api/ElementAPI.ts:157
fields?Record<string, unknown>Additional custom fields to attach to the interaction at creation timeapi/ElementAPI.ts:159
navigateTo?booleanWhether to navigate the agent desktop to the new interaction view after creation. Defaults to true. Set to false to create the interaction in the background.api/ElementAPI.ts:164
interactionType?stringInteraction type / work code category (maps to details.type on the backend)api/ElementAPI.ts:166
result?stringEnd result / disposition code to set at creation time (maps to details.result). Note: the equivalent updateInteraction() parameter is named endResult for backward compatibility with existing Elements.api/ElementAPI.ts:172
notes?stringNotes to attach at creation time (maps to details.notes)api/ElementAPI.ts:174
name?stringDisplay name of the source (customer) party (maps to sourceDetails.name). Naming matches the equivalent updateInteraction() field.api/ElementAPI.ts:179
email?stringExplicit source email address — takes priority over to for sourceDetails.email. Naming matches the equivalent updateInteraction() field.api/ElementAPI.ts:184
phone?stringExplicit source phone number — takes priority over to for sourceDetails.phoneNumber. Writing this field triggers full customer identity re-resolution on the platform: new person/session records are created keyed to the new number, and prior identifiers move to the archive. This is intentional platform behaviour — the same as editing the phone number in the native Desktop UI. Naming matches the equivalent updateInteraction() field.api/ElementAPI.ts:193
routingPhone?stringRouting phone number (maps to routingDetails.phoneNumber)api/ElementAPI.ts:195
routingPhoneName?stringDisplay name for the routing phone number (maps to routingDetails.phoneNumberName). Only forwarded when routingPhone is also provided; silently dropped if routingPhone is absent.api/ElementAPI.ts:197
customerLanguageCode?stringCustomer preferred language code (maps to customer.languageCode)api/ElementAPI.ts:199

InteractionContextOptions

Defined in: api/ElementAPI.ts:206

Common options for interaction-context methods
Used to optionally specify an interaction ID for app-level widgets

Properties

PropertyTypeDescriptionDefined in
interactionId?stringOptional interaction ID (required for app-level widgets, auto-provided for interaction-level widgets)api/ElementAPI.ts:208

SendRichMediaMessageOptions

Defined in: api/ElementAPI.ts:211

Properties

PropertyTypeDescriptionDefined in
name?string-api/ElementAPI.ts:212
mediaUrl?string-api/ElementAPI.ts:213
file?File-api/ElementAPI.ts:214
text?string-api/ElementAPI.ts:215
interactionId?stringOptional interaction ID (required for app-level widgets, auto-provided for interaction-level widgets)api/ElementAPI.ts:217

SendChatMessageOptions

Defined in: api/ElementAPI.ts:240

Properties

PropertyTypeDescriptionDefined in
interactionIdstringRequired interaction IDapi/ElementAPI.ts:242
text?stringOptional message textapi/ElementAPI.ts:244
mediaUrl?stringOptional media URL (image, file, etc.)api/ElementAPI.ts:246
file?FileOptional file to uploadapi/ElementAPI.ts:248
fileName?stringOptional file name for the message/fileapi/ElementAPI.ts:250
type?SendChatMessageTypeControls where and how the message is delivered. Omitting this parameter preserves today's behavior (sends as agent to customer). - "agent": Explicitly sends as the agent to the customer. - "private": Routes to the agent's feed only; customer does NOT see it. Persisted in the transcript. - "agentAssist": Routes to the Agent Assist panel UI; NOT in the main chat feed. Customer does NOT see it. Does not appear in the main transcript — visible in the AI Assist panel only. See SendChatMessageType for a full comparison.api/ElementAPI.ts:261

ConsultCallOptions

Defined in: api/ElementAPI.ts:264

Properties

PropertyTypeDescriptionDefined in
interactionIdstring-api/ElementAPI.ts:265
transferTo?stringUser ID or handle to consult with (internal user/agent)api/ElementAPI.ts:267
phoneNumber?stringPhone number to consult with (external number)api/ElementAPI.ts:269
queueId?stringQueue ID to consult to. Can be obtained via getTransferQueuesInteractionapi/ElementAPI.ts:271

TransferInteractionOptions

Defined in: api/ElementAPI.ts:279

Options for transferring an interaction to an agent, queue, or external address.
Works across all channel types. Digital channels support blind transfer only.
Voice additionally supports consult (attended) transfer.

Properties

PropertyTypeDescriptionDefined in
interactionIdstringThe interaction to transferapi/ElementAPI.ts:281
targetIdstringUser ID, queue ID, or external address to transfer toapi/ElementAPI.ts:283
targetName?stringDisplay name of the transfer targetapi/ElementAPI.ts:285
transferType"blind" | "consult"Transfer type. "blind" — supported for all channel types. Interaction is handed off immediately. "consult" — voice only. Places customer on hold; agent consults with target before completing. Returns CONSULT_NOT_SUPPORTED for digital channels (email, SMS, chat, task).api/ElementAPI.ts:292

AgentStatus

Defined in: api/ElementAPI.ts:295

Properties

PropertyTypeDefined in
idstringapi/ElementAPI.ts:296
namestringapi/ElementAPI.ts:297
categorystringapi/ElementAPI.ts:298

WrapUpInteractionOptions

Defined in: api/ElementAPI.ts:304

Options for wrapping up a completed interaction.

Properties

PropertyTypeDescriptionDefined in
dispositionCode?stringDisposition code to apply. Optional — if omitted the interaction is wrapped up without a disposition code. When provided, must exist in the queue's configured result list (if one is configured).api/ElementAPI.ts:310
notes?stringOptional notes to attach to the interactionapi/ElementAPI.ts:312

NavigateToOptions

Defined in: api/ElementAPI.ts:326

Per-call options for navigateTo(). Mirrors react-router's NavigateOptions.

No fields ship in API v1 — replace and state below are reserved for
a future API version and are currently silently ignored by the host. They are
declared on the type so partners can opt into the planned shape early; their
values are not yet honored at runtime.

Properties

PropertyTypeDescriptionDefined in
replace?booleanReplace the current history entry instead of pushing a new one. Remarks Reserved — not honored by the host in API v1. A future API version will honor this.api/ElementAPI.ts:332
state?unknownOpaque state to attach to the destination route's history entry. Remarks Reserved — not honored by the host in API v1. A future API version will honor this.api/ElementAPI.ts:339

NavigateToResponse

Defined in: api/ElementAPI.ts:345

Response from a navigation request.

Properties

PropertyTypeDescriptionDefined in
messagestringSuccess confirmation messageapi/ElementAPI.ts:347
pathstringThe path that was navigated toapi/ElementAPI.ts:349

UpdateInteractionFieldsBase

Defined in: api/ElementAPI.ts:352

Properties

PropertyTypeDescriptionDefined in
name?stringCustomer display nameapi/ElementAPI.ts:354
phone?stringCustomer phone number. Writing this field triggers full customer identity re-resolution on the platform: new person/session records are created keyed to the new number, and prior identifiers move to the archive. This is intentional platform behaviour — the same as editing the phone number in the native Desktop UI.api/ElementAPI.ts:362
email?stringCustomer email addressapi/ElementAPI.ts:364
subject?stringInteraction subject. On email channel this populates details.subject on the interaction record only — it does NOT pre-populate the native Desktop email compose editor.api/ElementAPI.ts:370
body?stringBody content for the interaction record (messaging channels only). On email channel this populates details.body on the interaction record only — it does NOT pre-populate the native Desktop email compose editor, which maintains a separate draft data model. On SMS channel, body updates the interaction record only — it does not update the live compose editor for an in-progress interaction.api/ElementAPI.ts:378
notes?stringNotes — persisted after wrap-upapi/ElementAPI.ts:380
interactionType?stringInteraction type / work code categoryapi/ElementAPI.ts:382
endResult?stringEnd result / disposition code (maps to details.result on the backend). Note: this field is named endResult here for backward compatibility with existing Elements; the equivalent createInteraction() parameter is named result.api/ElementAPI.ts:388
customerLanguageCode?stringCustomer preferred language code (maps to customer.languageCode)api/ElementAPI.ts:390
fields?Record<string, unknown>Custom key-value pairs to merge into the interaction's custom fieldsapi/ElementAPI.ts:392

TriggerWorkflowParams

Defined in: api/ElementAPI.ts:414

Parameters for triggering an AXP workflow from an element.

Properties

PropertyTypeDescriptionDefined in
workflowIdstringID of the workflow to executeapi/ElementAPI.ts:416
workflowVersion?stringOptional workflow version to execute. When omitted, the host defaults to "current".api/ElementAPI.ts:420
interactionId?stringOptional interaction ID override. When omitted the host automatically attaches the current interaction context. Required for app-level widgets that are not scoped to a single interaction.api/ElementAPI.ts:426
inputData?Record<string, unknown>Optional key/value input data forwarded to the workflow as its input parametersapi/ElementAPI.ts:428

TriggerWorkflowResponse

Defined in: api/ElementAPI.ts:434

Response returned after successfully triggering a workflow.

Properties

PropertyTypeDescriptionDefined in
workflowSessionIdstringID of the workflow session that was startedapi/ElementAPI.ts:436
messagestringHuman-readable confirmation messageapi/ElementAPI.ts:438

ReasonCode

Defined in: api/ElementAPI.ts:441

Properties

PropertyTypeDefined in
idstringapi/ElementAPI.ts:442
reasonstringapi/ElementAPI.ts:443
type"away" | "busy" | "available" | "queueLogout"api/ElementAPI.ts:444
typeDisplaystringapi/ElementAPI.ts:445
eliteAuxCode?numberapi/ElementAPI.ts:446
isDisabledbooleanapi/ElementAPI.ts:447
isSystemCode?booleanapi/ElementAPI.ts:448
createdAtstringapi/ElementAPI.ts:449
createdBystringapi/ElementAPI.ts:450
updatedAtstring | nullapi/ElementAPI.ts:451
updatedBystring | nullapi/ElementAPI.ts:452
inWorkflowIdstring | nullapi/ElementAPI.ts:453
inWorkflowVersionIdstring | nullapi/ElementAPI.ts:454
outWorkflowIdstring | nullapi/ElementAPI.ts:455
outWorkflowVersionIdstring | nullapi/ElementAPI.ts:456
queryFieldIdstring | nullapi/ElementAPI.ts:457

GetReasonCodesParams

Defined in: api/ElementAPI.ts:460

Properties

PropertyTypeDefined in
type?"away" | "busy" | "available" | "queueLogout" | nullapi/ElementAPI.ts:461

GetReasonCodesResponse

Defined in: api/ElementAPI.ts:464

Properties

PropertyTypeDefined in
reasonsReasonCode[]api/ElementAPI.ts:465

GetUserInteractionsParams

Defined in: api/ElementAPI.ts:468

Properties

PropertyTypeDefined in
userId?stringapi/ElementAPI.ts:469
details?booleanapi/ElementAPI.ts:470

QueueLoggedIn

Defined in: api/ElementAPI.ts:473

Properties

PropertyTypeDefined in
queueIdstringapi/ElementAPI.ts:474
namestringapi/ElementAPI.ts:475
queueWeightnumberapi/ElementAPI.ts:476
timeZonestringapi/ElementAPI.ts:477
extensionnumber | nullapi/ElementAPI.ts:478
createdOnstringapi/ElementAPI.ts:479
createdOnUnixnumberapi/ElementAPI.ts:480

QueueAccess

Defined in: api/ElementAPI.ts:483

Properties

PropertyTypeDefined in
queueIdstringapi/ElementAPI.ts:484
namestringapi/ElementAPI.ts:485
queueWeightnumberapi/ElementAPI.ts:486
timeZonestringapi/ElementAPI.ts:487
extensionnumber | nullapi/ElementAPI.ts:488

UserInteractionsUser

Defined in: api/ElementAPI.ts:491

Properties

PropertyTypeDefined in
idstringapi/ElementAPI.ts:492
firstNamestringapi/ElementAPI.ts:493
lastNamestringapi/ElementAPI.ts:494
fullNamestringapi/ElementAPI.ts:495
titlestring | nullapi/ElementAPI.ts:496
emailstringapi/ElementAPI.ts:497
extensionstring | nullapi/ElementAPI.ts:498

GetUserInteractionsResponse

Defined in: api/ElementAPI.ts:501

Properties

PropertyTypeDefined in
interactionsInteraction[]api/ElementAPI.ts:502
viewingInteraction[]api/ElementAPI.ts:503
combinedIds?string[]api/ElementAPI.ts:504
queue{ loggedIn: QueueLoggedIn[]; access: QueueAccess[]; }api/ElementAPI.ts:505
queue.loggedInQueueLoggedIn[]api/ElementAPI.ts:506
queue.accessQueueAccess[]api/ElementAPI.ts:507
userUserInteractionsUserapi/ElementAPI.ts:509

ElementAPIOptions

Defined in: api/ElementAPI.ts:515

Configuration options for ElementAPI initialization

Properties

PropertyTypeDescriptionDefined in
elementId?stringUnique identifier for this element instance (auto-generated if not provided)api/ElementAPI.ts:517
timeout?numberAPI request timeout in milliseconds (default: 5000)api/ElementAPI.ts:519
debug?booleanEnable debug logging to console (default: false)api/ElementAPI.ts:521
requestTarget?WindowWhen set (e.g. iframe.contentWindow), API sends requests to this window instead of window.parent. Use this when ElementAPI runs in the adaptor/bridge and the Agent UI is in an iframe.api/ElementAPI.ts:526
targetWindow?WindowLegacy alias for requestTarget. Kept for compatibility with an earlier shell/adaptor prototype.api/ElementAPI.ts:531
customerHosted?CustomerHostedSecurityOptionsEnables stricter iframe/origin checks for customer-hosted bridge/adaptor integrations. When set, ElementAPI validates the target iframe, pins postMessage to the configured origin, listens for iframe security changes, and blocks communication if the iframe becomes unsafe.api/ElementAPI.ts:538
security?ElementAPISecurityOptionsLegacy security option name from the earlier shell/child prototype. When security.iframe is provided, it is translated into customerHosted.api/ElementAPI.ts:543

CustomerHostedSecurityOptions

Defined in: api/ElementAPI.ts:549

Security configuration for customer-hosted bridge/adaptor integrations.

Properties

PropertyTypeDescriptionDefined in
iframeHTMLIFrameElementThe iframe that hosts Agent UI.api/ElementAPI.ts:551
targetOrigin?stringTrusted origin for outbound postMessage calls. Defaults to the iframe src origin. Must be an http(s) origin.api/ElementAPI.ts:556
requiredSandboxTokens?string[]Sandbox permissions that must be present on the iframe. Defaults to ["allow-scripts", "allow-same-origin"].api/ElementAPI.ts:561
disallowedSandboxTokens?string[]Sandbox permissions that are considered unsafe for the iframe. Defaults to ["allow-top-navigation", "allow-top-navigation-by-user-activation", "allow-popups-to-escape-sandbox"].api/ElementAPI.ts:566
monitorTampering?booleanWhether to watch iframe security attributes for runtime tampering. Defaults to true.api/ElementAPI.ts:571

ElementAPISecurityOptions

Defined in: api/ElementAPI.ts:580

Backward-compatible security configuration from the earlier shell/child prototype.

Prefer customerHosted for adaptor/bridge integrations. This interface is kept
so the earlier prototype's option names can be accepted without rewriting callers.

Properties

PropertyTypeDescriptionDefined in
iframe?HTMLIFrameElementThe iframe hosting Agent UI when running in shell/adaptor mode. When set, these options are translated into customerHosted.api/ElementAPI.ts:585
expectedOrigin?stringExpected iframe origin in shell/adaptor mode. Maps to customerHosted.targetOrigin.api/ElementAPI.ts:590
allowedParentOrigins?string[]Allowed parent origins from the original child-mode prototype. Retained for compatibility/documentation; the dedicated Agent UI security hook should enforce parent-origin checks in embedded child mode.api/ElementAPI.ts:596
monitorTampering?booleanWhether to monitor the iframe for runtime tampering. Maps to customerHosted.monitorTampering.api/ElementAPI.ts:601
requiredSandboxTokens?string[]Optional strict sandbox requirements to apply in shell/adaptor mode.api/ElementAPI.ts:605
disallowedSandboxTokens?string[]Optional disallowed sandbox permissions to apply in shell/adaptor mode.api/ElementAPI.ts:609

InteractionQueueInfo

Defined in: api/ElementAPI.ts:613

Properties

PropertyTypeDefined in
idstringapi/ElementAPI.ts:614
namestringapi/ElementAPI.ts:615
extensionstring | nullapi/ElementAPI.ts:616
waitingInteractionsnumberapi/ElementAPI.ts:617
countOfCallbacksnumberapi/ElementAPI.ts:618
countActiveAgentsnumberapi/ElementAPI.ts:619
totalCurrentInteractionsnumberapi/ElementAPI.ts:620
connectedInteractionsnumberapi/ElementAPI.ts:621
avgInteractionWaitTimenumberapi/ElementAPI.ts:622
weightnumberapi/ElementAPI.ts:623
eligiblebooleanapi/ElementAPI.ts:624

UserQueueInfo

Defined in: api/ElementAPI.ts:628

Properties

PropertyTypeDefined in
idstringapi/ElementAPI.ts:629
namestringapi/ElementAPI.ts:630

KeycloakConfig

Defined in: auth/KeycloakAuth.ts:29

Keycloak OAuth 2.0 PKCE Authentication Module

Sandboxed Iframe Environment

IMPORTANT: Elements run in sandboxed iframes using srcdoc, which means:

  • window.location.origin returns "null" (the literal string "null")
  • document.referrer may be empty
  • Direct fetch to external URLs may fail due to CORS
  • BroadcastChannel doesn't work (requires valid origin)

Because of these limitations:

  • Token refresh requests are delegated to the host via postMessage
  • The host (with a valid origin) makes the actual HTTP request
  • OAuth popup flow works because the popup opens redirect.html on the host's origin

OAuth Flow

Uses postMessage-based config exchange with redirect.html:

  1. Component opens popup directly
  2. redirect.html requests config via postMessage
  3. Component responds with config + code verifier
  4. redirect.html performs token exchange
  5. redirect.html sends token back to component

No localStorage bridging needed - config stays in memory.

Properties

PropertyTypeDescriptionDefined in
authorizationEndpoint?string-auth/KeycloakAuth.ts:30
tokenEndpoint?string-auth/KeycloakAuth.ts:31
clientId?string-auth/KeycloakAuth.ts:32
scopes?string[]-auth/KeycloakAuth.ts:33
redirectUri?stringURL to redirect.html - used for OAuth callback and token refreshauth/KeycloakAuth.ts:35

PopupOptions

Defined in: auth/KeycloakAuth.ts:38

Properties

PropertyTypeDefined in
width?numberauth/KeycloakAuth.ts:39
height?numberauth/KeycloakAuth.ts:40
left?numberauth/KeycloakAuth.ts:41
top?numberauth/KeycloakAuth.ts:42

TokenResponse

Defined in: auth/KeycloakAuth.ts:199

Properties

PropertyTypeDefined in
access_tokenstringauth/KeycloakAuth.ts:200
refresh_token?stringauth/KeycloakAuth.ts:201
expires_in?numberauth/KeycloakAuth.ts:202
refresh_expires_in?numberauth/KeycloakAuth.ts:203
token_type?stringauth/KeycloakAuth.ts:204
id_token?stringauth/KeycloakAuth.ts:205

StoredTokenData

Defined in: auth/KeycloakAuth.ts:208

Properties

PropertyTypeDefined in
accessTokenstringauth/KeycloakAuth.ts:209
refreshToken?stringauth/KeycloakAuth.ts:210
expiresAt?numberauth/KeycloakAuth.ts:211
refreshExpiresAt?numberauth/KeycloakAuth.ts:212

IframeValidationResult

Defined in: security/IframeSecurity.ts:9

Result of an iframe security validation check.

Properties

PropertyTypeDescriptionDefined in
validbooleanWhether the iframe passed all blocking security checks.security/IframeSecurity.ts:11
errorsstring[]Critical security issues that should block communication.security/IframeSecurity.ts:13
warningsstring[]Non-blocking issues worth surfacing to the caller.security/IframeSecurity.ts:15

IframeValidationOptions

Defined in: security/IframeSecurity.ts:21

Options for validating an iframe element's security configuration.

Properties

PropertyTypeDescriptionDefined in
expectedOrigin?stringExpected origin for the iframe's src URL. If provided, the iframe's src must resolve to this origin exactly.security/IframeSecurity.ts:26
requiredSandbox?string[]Sandbox tokens that must be present when a sandbox attribute exists. Defaults to ["allow-scripts", "allow-popups", "allow-forms"].security/IframeSecurity.ts:31
disallowedSandbox?string[]Sandbox tokens that must not be present. Defaults to [].security/IframeSecurity.ts:36
requireHttps?booleanWhether the iframe src must use HTTPS. Defaults to true.security/IframeSecurity.ts:41
requireSandbox?booleanWhether the iframe must declare a sandbox attribute. Defaults to false.security/IframeSecurity.ts:46

TamperDetails

Defined in: security/IframeSecurity.ts:52

Callback details when iframe tampering is detected.

Properties

PropertyTypeDescriptionDefined in
attributestringThe attribute that changed.security/IframeSecurity.ts:54
oldValuestring | nullThe original value captured when monitoring started.security/IframeSecurity.ts:56
newValuestring | nullThe new value after the mutation.security/IframeSecurity.ts:58

IframeMonitorOptions

Defined in: security/IframeSecurity.ts:68

Options for monitoring an iframe for security-critical attribute changes.

Uses a snapshot-and-compare model: all watched attribute values are captured
when monitorIframe() is called, and any subsequent change fires the
callback regardless of whether the new value is still "valid".

Properties

PropertyTypeDescriptionDefined in
onTamperDetected(details: TamperDetails) => voidCallback invoked when any watched attribute changes from its initial value.security/IframeSecurity.ts:72

CrmConfig

Defined in: types/iefConfig.ts:19

Admin-configured CRM settings for the current user.

The known fields below come from the user object's crmConfigurations
record. Additional admin-defined keys may be present — read them via the
index signature, but do not assume any unlisted key is guaranteed to exist.

Indexable

[key: string]: unknown

Additional admin-defined keys.

Properties

PropertyTypeDescriptionDefined in
idstringCRM configuration record id.types/iefConfig.ts:21
clickToDial?booleanWhether click-to-dial is enabled for this user.types/iefConfig.ts:23
clickToConsult?booleanWhether click-to-consult is enabled for this user.types/iefConfig.ts:25
omnichannelEnabled?"S" | "C" | "N"Omnichannel mode: "S" (single), "C" (concurrent), or "N" (none).types/iefConfig.ts:27
complementaryDefaultStatus?stringDefault status applied when complementary channel actions complete.types/iefConfig.ts:29

IEFConfig

Defined in: types/iefConfig.ts:43

Snapshot of the element's context within the current session.
Returned by ElementAPI.getConfig().

Expandable shape: new properties may be added in future releases —
element implementations should not rely on an exhaustive shape, and the
object should be read by property name rather than by destructuring against
a fixed key set.

Properties

PropertyTypeDescriptionDefined in
originalInteractionInteractionInfo | nullThe interaction that spawned this element, or null for home-based elements that were not launched from a specific interaction.types/iefConfig.ts:48
userIdstringAgent / user identity for the current session.types/iefConfig.ts:51
engagementIdstring | nullCustomer session identifier that persists throughout the customer's active session. Created when an interaction is initiated and survives transfers — the interactionId changes on transfer but this value remains the same. Resets to a new value when the interaction is closed-resolved and the customer contacts again. null when the element is home-based (not spawned from an interaction), or when the spawning interaction carries no engagement context.types/iefConfig.ts:63
crmConfigCrmConfig | nullAdmin-configured CRM settings for the current user. null if the user's CRM configuration could not be loaded.types/iefConfig.ts:69

Interaction

Defined in: types/interaction.ts:7

Properties

PropertyTypeDefined in
idstringtypes/interaction.ts:8
interactionIdstringtypes/interaction.ts:9
accountIdstringtypes/interaction.ts:10
initialCommTypestringtypes/interaction.ts:11
initialSubCommTypestringtypes/interaction.ts:12
commTypeCommTypetypes/interaction.ts:13
subCommTypestringtypes/interaction.ts:14
createdFromTransferCreatedFromTransfertypes/interaction.ts:15
completionCompletiontypes/interaction.ts:16
lastUpdated?stringtypes/interaction.ts:17
completionTimeUnix?numbertypes/interaction.ts:18
isAbandonedbooleantypes/interaction.ts:19
isMaxWaitbooleantypes/interaction.ts:20
ignoreUserHangupbooleantypes/interaction.ts:21
statusstringtypes/interaction.ts:22
startTimestringtypes/interaction.ts:23
startTimeUnixnumbertypes/interaction.ts:24
statusUpdatedAtstringtypes/interaction.ts:25
statusUpdatedAtUnixnumbertypes/interaction.ts:26
isCompletedbooleantypes/interaction.ts:27
isCompletedConference?booleantypes/interaction.ts:28
detailsDetailstypes/interaction.ts:29
customRecord<string, unknown> & { crm: { sfdc: { screenPopObjects?: unknown; }; msdynamics: { screenPopObjects?: unknown; }; }; crmobjects?: unknown[]; }types/interaction.ts:30
sourceDetailsSourceDetailstypes/interaction.ts:41
linkedIdsLinkedIdstypes/interaction.ts:42
routingDetailsRoutingDetailstypes/interaction.ts:43
pointsnumbertypes/interaction.ts:44
tagsTag[]types/interaction.ts:45
tagNamesstring[]types/interaction.ts:46
customerCustomertypes/interaction.ts:47
person?Persontypes/interaction.ts:48
assigneeRecord<string, unknown>types/interaction.ts:49
userUsertypes/interaction.ts:50
relatedUsersunknown[]types/interaction.ts:51
isMutebooleantypes/interaction.ts:52
isAudiobooleantypes/interaction.ts:53
isVideobooleantypes/interaction.ts:54
isHoldbooleantypes/interaction.ts:55
isCallbackbooleantypes/interaction.ts:56
isInVoicemailbooleantypes/interaction.ts:57
isBotbooleantypes/interaction.ts:58
isBotWorkflowSessionIdstring | nulltypes/interaction.ts:59
isExitNoAgentsbooleantypes/interaction.ts:60
isRipablebooleantypes/interaction.ts:61
isAIDbooleantypes/interaction.ts:62
isAIDCalculatedbooleantypes/interaction.ts:63
journey?{ query: string; value: string; }types/interaction.ts:64
journey.querystringtypes/interaction.ts:65
journey.valuestringtypes/interaction.ts:66
transfer?Transfertypes/interaction.ts:68
recordingRecordingtypes/interaction.ts:69
hadLiveTranscriptionCustomerbooleantypes/interaction.ts:70
hadLiveTranscriptionUserbooleantypes/interaction.ts:71
hadRecordingbooleantypes/interaction.ts:72
integrationsRecord<string, unknown>types/interaction.ts:73
queueQueuetypes/interaction.ts:74
nextTriggerNextTriggertypes/interaction.ts:75
maxWaitMaxWaittypes/interaction.ts:76
exitNoAgentsExitNoAgentstypes/interaction.ts:77
createdOnstringtypes/interaction.ts:78
createdOnUnixnumbertypes/interaction.ts:79
endTimestring | nulltypes/interaction.ts:80
metricsMetricstypes/interaction.ts:81
scoresScorestypes/interaction.ts:82
serverNamestring | nulltypes/interaction.ts:83
processIdstring | nulltypes/interaction.ts:84
timeoutTimestring | nulltypes/interaction.ts:85
isAIDRestrictedbooleantypes/interaction.ts:86
viewers?Viewer[]types/interaction.ts:87
isElitebooleantypes/interaction.ts:88
callFailed?{ error: { code: string; message: string; failReason: string; participantId: string; }; timestamp: string; }types/interaction.ts:89
callFailed.error{ code: string; message: string; failReason: string; participantId: string; }types/interaction.ts:90
callFailed.error.codestringtypes/interaction.ts:91
callFailed.error.messagestringtypes/interaction.ts:92
callFailed.error.failReasonstringtypes/interaction.ts:93
callFailed.error.participantIdstringtypes/interaction.ts:94
callFailed.timestampstringtypes/interaction.ts:96

Message

Defined in: types/message.ts:118

Properties

PropertyTypeDefined in
idstringtypes/message.ts:119
author{ displayName?: string; id?: string; type: "user" | "phoneNumber"; details?: { displayName?: string; id?: string; avatarUrl?: string; imageLastChangedAt?: string | null; }; }types/message.ts:120
author.displayName?stringtypes/message.ts:121
author.id?stringtypes/message.ts:122
author.type"user" | "phoneNumber"types/message.ts:123
author.details?{ displayName?: string; id?: string; avatarUrl?: string; imageLastChangedAt?: string | null; }types/message.ts:124
author.details.displayName?stringtypes/message.ts:125
author.details.id?stringtypes/message.ts:126
author.details.avatarUrl?stringtypes/message.ts:127
author.details.imageLastChangedAt?string | nulltypes/message.ts:128
displayNameOverride?stringtypes/message.ts:131
channel?stringtypes/message.ts:132
channelMessageComponentId?stringtypes/message.ts:133
createdAtstringtypes/message.ts:134
direction"in" | "out"types/message.ts:135
fromPhoneNumber?string | nulltypes/message.ts:136
isBotbooleantypes/message.ts:137
isCanned?booleantypes/message.ts:138
isDeleted?booleantypes/message.ts:139
isEdited?booleantypes/message.ts:140
isEmail?booleantypes/message.ts:141
isMms?booleantypes/message.ts:142
isPinned?booleantypes/message.ts:143
isPrivatebooleantypes/message.ts:144
isSaved?booleantypes/message.ts:145
isSms?booleantypes/message.ts:146
messagestring | FancyMessage[]types/message.ts:147
paginationIdstringtypes/message.ts:148
pinnedAtstring | nulltypes/message.ts:149
pinnedBystring | nulltypes/message.ts:150
pinnedByUserFirstLastNamestring | nulltypes/message.ts:151
subType?MessageSubTypetypes/message.ts:152
type"email" | "sms" | "chat"types/message.ts:153
updatedAt?string | nulltypes/message.ts:154
threadChannelMessageId?string | nulltypes/message.ts:155
translations?Record<string, string>types/message.ts:156

GetUsersResponse

Defined in: types/user.ts:10

Response from getUsers API
Used for transfer/consult target selection

Properties

PropertyTypeDescriptionDefined in
idstringHandle / internal user IDtypes/user.ts:12
firstNamestringFirst nametypes/user.ts:14
lastNamestringLast nametypes/user.ts:16
fullNamestringFull nametypes/user.ts:18
emailstringEmail addresstypes/user.ts:20
mobilestring | nullMobile phone numbertypes/user.ts:22
presencestring | nullVoIP/presence status (e.g., "available", "busy", "offline")types/user.ts:24
cxStatus{ statusType: string; status: string; }CX status informationtypes/user.ts:26
cxStatus.statusTypestringCX status category (e.g., "available", "busy", "away")types/user.ts:28
cxStatus.statusstringCX status display name (e.g., "Available", "On Call", "Lunch")types/user.ts:30
extensionstring | nullExtension numbertypes/user.ts:33
eligiblebooleanWhether user is eligible for transfertypes/user.ts:35

UserLocation

Defined in: types/user.ts:38

Properties

PropertyTypeDefined in
addressData?{ address1: string; address2: string; city: string; state: string; country: string; postalCode: string; locationName: string; }types/user.ts:39
addressData.address1stringtypes/user.ts:40
addressData.address2stringtypes/user.ts:41
addressData.citystringtypes/user.ts:42
addressData.statestringtypes/user.ts:43
addressData.countrystringtypes/user.ts:44
addressData.postalCodestringtypes/user.ts:45
addressData.locationNamestringtypes/user.ts:46
locationIdstringtypes/user.ts:48
e911Numberstringtypes/user.ts:49
isE911string | booleantypes/user.ts:50
e911CallerIdNumber?string | nulltypes/user.ts:51

QueueInfo

Defined in: types/user.ts:54

Properties

PropertyTypeDefined in
queueIdstringtypes/user.ts:55
namestringtypes/user.ts:56
isAccessbooleantypes/user.ts:57
isAutoLoginbooleantypes/user.ts:58
proficiency?unknowntypes/user.ts:59

UserTag

Defined in: types/user.ts:62

Properties

PropertyTypeDefined in
tagIdstringtypes/user.ts:63
backgroundColorstringtypes/user.ts:64
colorstringtypes/user.ts:65
iconCodestringtypes/user.ts:66
namestringtypes/user.ts:67

DefaultLeaveEventToStatus

Defined in: types/user.ts:70

Properties

PropertyTypeDefined in
actionstringtypes/user.ts:71
statusstringtypes/user.ts:72

InfinityElement

Defined in: types/user.ts:94

Properties

PropertyTypeDefined in
accountIdstringtypes/user.ts:95
apiVersionIdstringtypes/user.ts:96
configInfinityElementConfigtypes/user.ts:97
createdAtstringtypes/user.ts:98
createdBystringtypes/user.ts:99
folderIdstring | nulltypes/user.ts:100
iconstringtypes/user.ts:101
idstringtypes/user.ts:102
namestringtypes/user.ts:103
tagNamestringtypes/user.ts:104
updatedAtstringtypes/user.ts:105
updatedBystring | nulltypes/user.ts:106
uploadedAtstring | nulltypes/user.ts:107
uploadedBystring | nulltypes/user.ts:108

UserInfo

Defined in: types/user.ts:111

Properties

PropertyTypeDescriptionDefined in
userIdstringUser IDtypes/user.ts:114
status?stringWhether the user is enabled (status === 'enabled' for yes)types/user.ts:116
firstNamestringFirst nametypes/user.ts:118
lastNamestringLast nametypes/user.ts:120
nameSuffix?string | nullName suffix (e.g., Jr., Sr., III)types/user.ts:122
titlestringJob titletypes/user.ts:124
emailstringEmail addresstypes/user.ts:126
mobile?string | nullMobile phone numbertypes/user.ts:128
languageCode?stringLanguage code (e.g., 'en', 'es')types/user.ts:130
location?UserLocation | nullE911 location informationtypes/user.ts:132
timezone?stringTimezone (e.g., 'America/New_York')types/user.ts:134
licenseType?stringLicense typetypes/user.ts:138
consolePermissions?{ account?: Record<"read", string>; api?: Record<"read", string>; callRecordings?: Record<"delete", string>; cx?: Record<"read", string>; mL?: Record<"read", string>; numbers?: Record<"read", string>; objects?: Record<"read", string>; portal?: Record<"console-web", string>; queues?: Record<"read", string>; }Console permissionstypes/user.ts:140
consolePermissions.account?Record<"read", string>-types/user.ts:141
consolePermissions.api?Record<"read", string>-types/user.ts:142
consolePermissions.callRecordings?Record<"delete", string>-types/user.ts:143
consolePermissions.cx?Record<"read", string>-types/user.ts:144
consolePermissions.mL?Record<"read", string>-types/user.ts:145
consolePermissions.numbers?Record<"read", string>-types/user.ts:146
consolePermissions.objects?Record<"read", string>-types/user.ts:147
consolePermissions.portal?Record<"console-web", string>-types/user.ts:148
consolePermissions.queues?Record<"read", string>-types/user.ts:149
appPermissions?{ agent?: Record<"read", string>; analytics?: Record<"read", string>; chat?: Record<"read" | "admin", string>; coaching?: Record<"read", string>; contacts?: Record<"read", string>; workflowReplay?: Record<"read", string>; dashboards?: Record<"read", string>; portal?: { app-android: string; app-ios: string; app-osx: string; app-web: string; app-win: string; app-support-access: string; }; queueList?: Record<"read", string>; queueToggling?: Record<"read", string>; teamview?: Record<"read", string>; ucFax?: Record<"read", string>; outreachmonitor?: Record<"read", string>; }Application permissionstypes/user.ts:152
appPermissions.agent?Record<"read", string>-types/user.ts:153
appPermissions.analytics?Record<"read", string>-types/user.ts:154
appPermissions.chat?Record<"read" | "admin", string>-types/user.ts:155
appPermissions.coaching?Record<"read", string>-types/user.ts:156
appPermissions.contacts?Record<"read", string>-types/user.ts:157
appPermissions.workflowReplay?Record<"read", string>-types/user.ts:158
appPermissions.dashboards?Record<"read", string>-types/user.ts:159
appPermissions.portal?{ app-android: string; app-ios: string; app-osx: string; app-web: string; app-win: string; app-support-access: string; }-types/user.ts:160
appPermissions.portal.app-androidstring-types/user.ts:161
appPermissions.portal.app-iosstring-types/user.ts:162
appPermissions.portal.app-osxstring-types/user.ts:163
appPermissions.portal.app-webstring-types/user.ts:164
appPermissions.portal.app-winstring-types/user.ts:165
appPermissions.portal.app-support-accessstring-types/user.ts:166
appPermissions.queueList?Record<"read", string>-types/user.ts:168
appPermissions.queueToggling?Record<"read", string>-types/user.ts:169
appPermissions.teamview?Record<"read", string>-types/user.ts:170
appPermissions.ucFax?Record<"read", string>-types/user.ts:171
appPermissions.outreachmonitor?Record<"read", string>-types/user.ts:172
outboundPermissions?{ task: "0" | "1"; email: "0" | "1"; phone: "0" | "1"; messaging: "0" | "1"; }Outbound permissions by communication typetypes/user.ts:175
outboundPermissions.task"0" | "1"-types/user.ts:176
outboundPermissions.email"0" | "1"-types/user.ts:177
outboundPermissions.phone"0" | "1"-types/user.ts:178
outboundPermissions.messaging"0" | "1"-types/user.ts:179
rejectInteractions?booleanInbound permissions - can reject interactionstypes/user.ts:182
monitoringAction?stringMonitoring action configurationtypes/user.ts:184
completedAction?stringCompleted action configurationtypes/user.ts:186
interactionViewsType?stringInteraction view typetypes/user.ts:188
modifyInteractionViews?booleanCan create/edit interaction viewstypes/user.ts:190
tags?UserTag[]List of assigned tagstypes/user.ts:194
personalQueueId?stringPersonal queue IDtypes/user.ts:198
defaultOutboundQueue?stringDefault outbound queue nametypes/user.ts:200
outboundActionAndStatus?DefaultLeaveEventToStatusOutbound call action and statustypes/user.ts:202
inboundActionAndStatus?DefaultLeaveEventToStatusInbound call action and statustypes/user.ts:204
callbackActionAndStatus?DefaultLeaveEventToStatusCallback action and statustypes/user.ts:206
voicemailActionAndStatus?DefaultLeaveEventToStatusVoicemail action and statustypes/user.ts:208
queues?QueueInfo[]List of assigned queues with access, auto-login, and proficiency infotypes/user.ts:210
phoneSpaces?numberNumber of concurrent phone interactions allowedtypes/user.ts:214
messagingSpaces?numberNumber of concurrent messaging interactions allowedtypes/user.ts:216
emailSpaces?numberNumber of concurrent email interactions allowedtypes/user.ts:218
taskSpaces?numberNumber of concurrent task interactions allowedtypes/user.ts:220
eliteExtension?string | nullElite Agent Extensiontypes/user.ts:224
eliteAgentId?string | nullElite Agent IDtypes/user.ts:226
eliteSipAddress?string | nullSIP Addresstypes/user.ts:228
eliteSbcGroupId?string | nullSBC Group IDtypes/user.ts:230
crmConfigurations?unknownCRM Configuration objecttypes/user.ts:234
infinityElements?InfinityElement[]App-level Infinity Elements assignedtypes/user.ts:236
authToken?stringAuthentication token (JWT) using accessTokentypes/user.ts:240

SendChatMessageType

type SendChatMessageType = "agent" | "private" | "agentAssist";

Defined in: api/ElementAPI.ts:238

Controls where and how a sendChatMessage() call is delivered.

valueWho sees itWhere it appearsTranscript
"agent"Agent + CustomerMain chat feedMain transcript
"private"Agent onlyMain chat feed (distinct styling)Main transcript
"agentAssist"Agent onlyAgent Assist panel UIAI Assist panel only
  • "agent": Sends to the customer as the agent (default, existing behavior).
  • "private": Appears in the agent's feed only; customer does NOT see it.
    Persisted in the main interaction transcript for QA and supervisor review.
  • "agentAssist": Routes to the Agent Assist panel UI, NOT the main chat feed.
    Customer does NOT see it. Does NOT appear in the main interaction transcript;
    visible in the AI Assist panel only (persists for the session). Requires the
    Agent Assist panel to be enabled for the queue (fg_ai_assist gate + queue
    panels config); if not enabled the message is stored in V4 but not surfaced.

RoutingFieldsPair

type RoutingFieldsPair = 
  | {
  routingPhone: string;
  routingPhoneName: string;
}
  | {
  routingPhone?: never;
  routingPhoneName?: never;
};

Defined in: api/ElementAPI.ts:397


UpdateInteractionFields

type UpdateInteractionFields = UpdateInteractionFieldsBase & RoutingFieldsPair;

Defined in: api/ElementAPI.ts:409

Fields that can be updated on an active interaction.
At least one field must be provided.

routingPhone and routingPhoneName must always be provided together.
TypeScript callers get a compile-time error; JavaScript callers receive a
bridge runtime error.


InteractionStatusChangedCallback()

type InteractionStatusChangedCallback = (payload: {
  interactionId: string;
  status: string;
}) => void;

Defined in: api/ElementAPIEvents.ts:22

Parameters

ParameterType
payload{ interactionId: string; status: string; }
payload.interactionIdstring
payload.statusstring

Returns

void


InteractionEndedCallback()

type InteractionEndedCallback = (interactionId: string) => void;

Defined in: api/ElementAPIEvents.ts:26

Parameters

ParameterType
interactionIdstring

Returns

void


InteractionAcceptedCallback()

type InteractionAcceptedCallback = (interactionId: string) => void;

Defined in: api/ElementAPIEvents.ts:27

Parameters

ParameterType
interactionIdstring

Returns

void


InteractionUpdatedCallback()

type InteractionUpdatedCallback = (payload: {
  interactionId: string;
  event: "interaction.update";
  payload: Interaction;
}) => void;

Defined in: api/ElementAPIEvents.ts:28

Parameters

ParameterType
payload{ interactionId: string; event: "interaction.update"; payload: Interaction; }
payload.interactionIdstring
payload.event"interaction.update"
payload.payloadInteraction

Returns

void


ConsultStatusChangedCallback()

type ConsultStatusChangedCallback = (payload: {
  interactionId: string;
  consultStatus: string;
  consultParty?: string;
  error?: string;
}) => void;

Defined in: api/ElementAPIEvents.ts:33

Parameters

ParameterType
payload{ interactionId: string; consultStatus: string; consultParty?: string; error?: string; }
payload.interactionIdstring
payload.consultStatusstring
payload.consultParty?string
payload.error?string

Returns

void


CompleteAsConferenceCallback()

type CompleteAsConferenceCallback = (payload: {
  interactionId: string;
}) => void;

Defined in: api/ElementAPIEvents.ts:39

Parameters

ParameterType
payload{ interactionId: string; }
payload.interactionIdstring

Returns

void


InteractionDataReloadCallback()

type InteractionDataReloadCallback = (interactionId: string) => void;

Defined in: api/ElementAPIEvents.ts:47

Callback invoked after a successful updateInteraction() call, signalling the element
to refresh its local copy of the specified interaction's data.

Parameters

ParameterTypeDescription
interactionIdstringID of the interaction whose data should be reloaded

Returns

void


InteractionFocusChangedCallback()

type InteractionFocusChangedCallback = (interactionId: string | null) => void;

Defined in: api/ElementAPIEvents.ts:54

Callback fired when the agent's focused interaction changes.
Receives the interactionId of the newly focused interaction, or null when
the agent navigates away from all interactions (e.g. Home, Analytics).

Parameters

ParameterType
interactionIdstring | null

Returns

void


FeedMessageCallback()

type FeedMessageCallback = (message: Message, interactionId?: string) => void;

Defined in: api/ElementAPIEvents.ts:61

Callback for feed message events.

Parameters

ParameterTypeDescription
messageMessageThe message received
interactionId?stringOptional interaction ID the message belongs to

Returns

void


ErrorCallback()

type ErrorCallback = (error: {
  code: string;
  message: string;
  details?: unknown;
}) => void;

Defined in: api/ElementAPIEvents.ts:65

Parameters

ParameterType
error{ code: string; message: string; details?: unknown; }
error.codestring
error.messagestring
error.details?unknown

Returns

void


AgentStateSnapshot

type AgentStateSnapshot = {
  status: string;
  statusType: string;
};

Defined in: api/ElementAPIEvents.ts:71

Properties

PropertyTypeDefined in
statusstringapi/ElementAPIEvents.ts:72
statusTypestringapi/ElementAPIEvents.ts:73

AgentQueueSnapshot

type AgentQueueSnapshot = {
  queueId: string;
  queueName: string;
  loggedIn: boolean;
};

Defined in: api/ElementAPIEvents.ts:76

Properties

PropertyTypeDefined in
queueIdstringapi/ElementAPIEvents.ts:77
queueNamestringapi/ElementAPIEvents.ts:78
loggedInbooleanapi/ElementAPIEvents.ts:79

GetAgentStateResponse

type GetAgentStateResponse = {
  agentState: string;
  isAID: boolean;
  agentId: string;
  reasonCode: string | null;
  queues: AgentQueueSnapshot[];
  currentState: AgentStateSnapshot;
  timestamp: string;
};

Defined in: api/ElementAPIEvents.ts:86

Result of ElementAPI.getAgentState: current cached agent desktop state
(no HTTP). Aligns with agent-state-changed broadcast fields used for initial snapshot.

Properties

PropertyTypeDefined in
agentStatestringapi/ElementAPIEvents.ts:87
isAIDbooleanapi/ElementAPIEvents.ts:88
agentIdstringapi/ElementAPIEvents.ts:89
reasonCodestring | nullapi/ElementAPIEvents.ts:90
queuesAgentQueueSnapshot[]api/ElementAPIEvents.ts:91
currentStateAgentStateSnapshotapi/ElementAPIEvents.ts:92
timestampstringapi/ElementAPIEvents.ts:93

AgentStateChangedCallback()

type AgentStateChangedCallback = (payload: {
  previousState: string;
  currentState: string;
  reason?: string;
}) => void;

Defined in: api/ElementAPIEvents.ts:97

Parameters

ParameterType
payload{ previousState: string; currentState: string; reason?: string; }
payload.previousStatestring
payload.currentStatestring
payload.reason?string

Returns

void

Deprecated

Use AgentStateChangedPayload via ElementAPI.onAgentStateChange instead


AgentStateChangedPayload

type AgentStateChangedPayload = {
  previousState: AgentStateSnapshot | null;
  currentState: AgentStateSnapshot;
  reason?: string;
  agentState: string;
  isAID?: boolean;
  queues?: AgentQueueSnapshot[];
  timestamp?: string;
  agentId?: string;
  reasonCode?: string | null;
};

Defined in: api/ElementAPIEvents.ts:103

Properties

PropertyTypeDefined in
previousStateAgentStateSnapshot | nullapi/ElementAPIEvents.ts:104
currentStateAgentStateSnapshotapi/ElementAPIEvents.ts:105
reason?stringapi/ElementAPIEvents.ts:106
agentStatestringapi/ElementAPIEvents.ts:107
isAID?booleanapi/ElementAPIEvents.ts:108
queues?AgentQueueSnapshot[]api/ElementAPIEvents.ts:109
timestamp?stringapi/ElementAPIEvents.ts:110
agentId?stringapi/ElementAPIEvents.ts:111
reasonCode?string | nullapi/ElementAPIEvents.ts:112

AgentStateChangeCallback()

type AgentStateChangeCallback = (payload: AgentStateChangedPayload) => void;

Defined in: api/ElementAPIEvents.ts:115

Parameters

ParameterType
payloadAgentStateChangedPayload

Returns

void


InfinityElementConfig

type InfinityElementConfig = 
  | {
  hostingType: "local";
  file: {
     filename: string;
     mimetype: string;
     size: number;
     storageId: string;
     fileUrl?: string;
  };
}
  | {
  hostingType: "remote";
  remoteUrl: string;
  sameOriginEnabled: boolean;
};

Defined in: types/user.ts:75

Type Declaration

{
  hostingType: "local";
  file: {
     filename: string;
     mimetype: string;
     size: number;
     storageId: string;
     fileUrl?: string;
  };
}
NameTypeDefined in
hostingType"local"types/user.ts:77
file{ filename: string; mimetype: string; size: number; storageId: string; fileUrl?: string; }types/user.ts:78
file.filenamestringtypes/user.ts:79
file.mimetypestringtypes/user.ts:80
file.sizenumbertypes/user.ts:81
file.storageIdstringtypes/user.ts:82
file.fileUrl?stringtypes/user.ts:83
{
  hostingType: "remote";
  remoteUrl: string;
  sameOriginEnabled: boolean;
}
NameTypeDescriptionDefined in
hostingType"remote"-types/user.ts:87
remoteUrlstringThe external URL where this Infinity Element is hostedtypes/user.ts:89
sameOriginEnabledbooleanWhen true, allow-same-origin is added to the iframe sandbox, letting the remote widget access its own origin's cookies/storagetypes/user.ts:91

CHANNEL_NAMES

const CHANNEL_NAMES: {
  INTERACTION_STATUS_CHANGED: "interaction-status-changed";
  INTERACTION_ENDED: "on-interaction-ended";
  INTERACTION_ACCEPTED: "on-interaction-accepted";
  INTERACTION_UPDATED: "on-interaction-updated";
  CONSULT_STATUS_CHANGED: "consult-status-changed";
  COMPLETE_AS_CONFERENCE: "on-complete-as-conference";
  FEED_MESSAGE: "feed-message";
  AGENT_STATE_CHANGED: "agent-state-changed";
  INTER_ELEMENT: "inter-element";
  INTERACTION_DATA_RELOAD: "interaction-data-reload";
  INTERACTION_FOCUS_CHANGED: "on-interaction-focus-changed";
};

Defined in: api/ElementAPIEvents.ts:5

Type Declaration

NameTypeDefault valueDefined in
INTERACTION_STATUS_CHANGED"interaction-status-changed""interaction-status-changed"api/ElementAPIEvents.ts:7
INTERACTION_ENDED"on-interaction-ended""on-interaction-ended"api/ElementAPIEvents.ts:8
INTERACTION_ACCEPTED"on-interaction-accepted""on-interaction-accepted"api/ElementAPIEvents.ts:9
INTERACTION_UPDATED"on-interaction-updated""on-interaction-updated"api/ElementAPIEvents.ts:10
CONSULT_STATUS_CHANGED"consult-status-changed""consult-status-changed"api/ElementAPIEvents.ts:11
COMPLETE_AS_CONFERENCE"on-complete-as-conference""on-complete-as-conference"api/ElementAPIEvents.ts:12
FEED_MESSAGE"feed-message""feed-message"api/ElementAPIEvents.ts:13
AGENT_STATE_CHANGED"agent-state-changed""agent-state-changed"api/ElementAPIEvents.ts:14
INTER_ELEMENT"inter-element""inter-element"api/ElementAPIEvents.ts:16
INTERACTION_DATA_RELOAD"interaction-data-reload""interaction-data-reload"api/ElementAPIEvents.ts:18
INTERACTION_FOCUS_CHANGED"on-interaction-focus-changed""on-interaction-focus-changed"api/ElementAPIEvents.ts:19

VERSION

const VERSION: "1.3.1" = "1.3.1";

Defined in: index.ts:114


setupOAuthCallbackHandler()

function setupOAuthCallbackHandler(): void;

Defined in: auth/KeycloakAuth.ts:74

Setup OAuth callback handler - call once at app initialization

Sets up listener for redirect.html config requests

Returns

void


refreshAccessToken()

function refreshAccessToken(
   refreshToken: string, 
   tokenEndpoint: string, 
clientId: string): Promise<TokenResponse>;

Defined in: auth/KeycloakAuth.ts:229

Refresh an expired access token using the refresh token

Elements run in sandboxed iframes (about:srcdoc) which have origin "null".
Direct fetch to Keycloak fails due to CORS.

This function delegates the refresh request to the host (agent-ui) via
postMessage. The host has a proper origin and can make the request
without CORS issues. This is completely silent - no popups or visible UI.

Parameters

ParameterTypeDescription
refreshTokenstringThe refresh token to use
tokenEndpointstringThe token endpoint URL
clientIdstringThe OAuth client ID

Returns

Promise<TokenResponse>


getStoredTokenData()

function getStoredTokenData(jwtStorageKey: string): StoredTokenData | null;

Defined in: auth/KeycloakAuth.ts:359

Get stored token data from localStorage

Parameters

ParameterType
jwtStorageKeystring

Returns

StoredTokenData | null


isTokenExpired()

function isTokenExpired(tokenData: StoredTokenData): boolean;

Defined in: auth/KeycloakAuth.ts:386

Check if a token is expired

Parameters

ParameterType
tokenDataStoredTokenData

Returns

boolean


isRefreshTokenExpired()

function isRefreshTokenExpired(tokenData: StoredTokenData): boolean;

Defined in: auth/KeycloakAuth.ts:401

Check if refresh token is expired

Parameters

ParameterType
tokenDataStoredTokenData

Returns

boolean


Did this page help you?