///
import { Activity } from 'twilio-taskrouter';
import { ActivityOptions } from 'twilio-taskrouter';
import { ApolloClient } from '@apollo/client/core';
import { ApolloLink } from '@apollo/client/core';
import { Call } from '@twilio/voice-sdk';
import { CallOptions } from 'twilio-taskrouter';
import { Channel } from 'twilio-taskrouter';
import { ChannelEvents } from 'twilio-taskrouter';
import { ConferenceOptions } from 'twilio-taskrouter';
import { Participant as ConversationParticipant } from '@twilio/conversations';
import { ParticipantType as ConversationParticipantType } from '@twilio/conversations';
import { ParticipantUpdateReason as ConversationParticipantUpdateReason } from '@twilio/conversations';
import { Client as ConversationsClient } from '@twilio/conversations';
import { ConversationStatus } from '@twilio/conversations';
import { User as ConversationsUser } from '@twilio/conversations';
import { ConversationUpdateReason } from '@twilio/conversations';
import { DeliveryStatus } from '@twilio/conversations';
import { DequeueOptions } from 'twilio-taskrouter';
import { Device } from '@twilio/voice-sdk';
import { DocumentNode } from '@apollo/client/core';
import { FetchTaskQueuesParams } from 'twilio-taskrouter';
import { FetchWorkersInfoParams } from 'twilio-taskrouter';
import { FetchWorkersParams } from 'twilio-taskrouter';
import { IncomingTransfer } from 'twilio-taskrouter';
import { LogLevelDesc } from 'loglevel';
import { LogLevelNumbers } from 'loglevel';
import { Media } from '@twilio/conversations';
import { MediaCategory } from '@twilio/conversations';
import { Message } from '@twilio/conversations';
import { MessageBuilder } from '@twilio/conversations';
import { MessageType } from '@twilio/conversations';
import { MessageUpdateReason } from '@twilio/conversations';
import { NormalizedCacheObject } from '@apollo/client/core';
import { NotificationLevel } from '@twilio/conversations';
import { OutgoingTransfer } from 'twilio-taskrouter';
import { Paginator as Paginator_2 } from '@twilio/conversations';
import { ParticipantEmailLevel } from '@twilio/conversations';
import { PushNotification } from '@twilio/conversations';
import { RedirectOptions } from 'twilio-taskrouter';
import { RejectOptions } from 'twilio-taskrouter';
import { Reservation } from 'twilio-taskrouter';
import { ReservationEvents } from 'twilio-taskrouter';
import { ReservationParticipantOptions } from 'twilio-taskrouter';
import { Resolvers } from '@apollo/client/core';
import { Supervisor as Supervisor_2 } from 'twilio-taskrouter';
import { Task } from 'twilio-taskrouter';
import { TaskEvents } from 'twilio-taskrouter';
import { TaskHoldOptions } from 'twilio-taskrouter';
import { TaskOptions } from 'twilio-taskrouter';
import { TaskParticipantOptions } from 'twilio-taskrouter';
import { TaskQueue as TaskRouterTaskQueue } from 'twilio-taskrouter';
import { TaskTransferOptions } from 'twilio-taskrouter';
import { TransferOptions } from 'twilio-taskrouter';
import { Transfers } from 'twilio-taskrouter';
import { Conversation as TwilioConversation } from '@twilio/conversations';
import type TypedEmitter from 'typed-emitter';
import { TypePolicies } from '@apollo/client/cache/inmemory/policies';
import { UserUpdateReason } from '@twilio/conversations';
import { Worker as Worker_3 } from 'twilio-taskrouter';
import { WorkerEvents } from 'twilio-taskrouter';
import { WorkerInfo } from 'twilio-taskrouter';
import { WorkerOptions as WorkerOptions_2 } from 'twilio-taskrouter';
import { Workspace } from 'twilio-taskrouter';
import { WorkspaceOptions } from 'twilio-taskrouter';
import { WrappingOptions } from 'twilio-taskrouter';
/**
* Accepts a task and reserves it for the current worker.
* @category Actions
*
* @remarks
* For **voice tasks**, you must register a `VoiceClientEvent` listener with `AddVoiceEventListener` before running this action.
* If this is not done, accepting the task may fail.
*
* @param taskSid - The unique identifier (SID) of the task to be accepted.
* @param options - Optional configuration parameters for customizing the task acceptance process.
*
* @returns A promise that resolves to a `Reservation` and a `Task` object representing the accepted task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.FailedToAcceptReservation}
* - {@link ErrorCode.FailedToCreateConference}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { AcceptTask } from "@twilio/flex-sdk/actions/Task";
*
* async function acceptTask() {
* const client = await createClient("SDK_TOKEN");
* const acceptTask = new AcceptTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const { task, reservation } = await client.execute(acceptTask);
* return { task, reservation };
* }
* ```
*
* @public
*/
export declare class AcceptTask implements Action> {
constructor(taskSid: string, options?: AcceptTaskOptions);
run(ctx: {}): Promise<{
task: Task;
reservation: Reservation;
}>;
}
/**
* @public
*/
export declare interface AcceptTaskOptions {
conferenceOptions?: ConferenceOptions;
}
/**
* Account Configuration Data Response
* @public
*/
export declare interface AccountConfigData {
/**
* The SID of the Account that created the resource
*/
accountSid: string;
/**
* An object that contains application-specific data
*/
attributes: object;
/**
* Whether call recording is enabled
*/
callRecordingEnabled: boolean;
/**
* The call recording webhook URL
*/
callRecordingWebhookUrl: string | null;
/**
* A list of objects that contain the configuration for different channels
*/
channelConfigs: Array | null;
/**
* The SID of the chat service this user belongs to
*/
chatServiceInstanceSid: string;
/**
* An object that contains the CRM attributes
*/
crmAttributes: object | null;
/**
* A list of objects that contain the configurations for the Integrations supported in this configuration
*/
integrations?: Array | null;
/**
* The CRM Callback URL
*/
crmCallbackUrl: string | null;
/**
* Whether CRM is present for Flex
*/
crmEnabled: boolean | null;
/**
* The CRM Fallback URL
*/
crmFallbackUrl: string | null;
/**
* The CRM type
*/
crmType: string | null;
/**
* The ISO 8601 date and time in GMT when the Configuration resource was created
*/
dateCreated: Date;
/**
* The ISO 8601 date and time in GMT when the Configuration resource was last updated
*/
dateUpdated: Date;
debuggerIntegration: DebuggerIntegration | null;
flexUiStatusReport: FlexUiStatusReport | null;
citrixVoiceVdi: CitrixVoiceVdi | null;
/**
* The SID of the Messaging service instance
*/
messagingServiceInstanceSid: string | null;
/**
* The URL where the Flex instance is hosted
*/
runtimeDomain: string;
/**
* The SID of the Flex service instance
*/
flexServiceInstanceSid: string | null;
/**
* The SID of the Flex instance
*/
flexInstanceSid: string | null;
/**
* The list of outbound call flows
*/
outboundCallFlows: {
[key: string]: OutboundFlows;
} | null;
/**
* If flex-ui should load plugins
*/
pluginServiceEnabled: boolean | null;
/**
* The plugin service attributes
*/
pluginServiceAttributes: object | null;
/**
* The list of public attributes, which are visible to unauthenticated clients
*/
publicAttributes: object;
/**
* The Flex Service version
*/
serviceVersion: string | null;
/**
* The list of serverless service SIDs
*/
serverlessServiceSids: Array | null;
/**
* The status of the Flex onboarding. Can be: \'ok\', \'inprogress\',\'notstarted\'
*/
status: string;
/**
* The TaskRouter SID of the offline activity
*/
taskrouterOfflineActivitySid?: string;
/**
* The Skill description for TaskRouter workers
*/
taskrouterSkills?: Array;
/**
* The SID of the TaskRouter Target TaskQueue
*/
taskrouterTargetTaskqueueSid: string;
/**
* The SID of the TaskRouter target Workflow
*/
taskrouterTargetWorkflowSid: string;
/**
* The list of TaskRouter TaskQueues
*/
taskrouterTaskqueues: Array | null;
/**
* The TaskRouter Worker attributes
*/
taskrouterWorkerAttributes: {
[key: string]: object;
} | null;
/**
* The TaskRouter default channel capacities and availability for workers
*/
taskrouterWorkerChannels: {
[key: string]: WorkerChannel;
} | null;
/**
* The SID of the TaskRouter Workspace
*/
taskrouterWorkspaceSid: string;
/**
* The object that defines the NPM packages and versions to be used in Hosted Flex
*/
uiDependencies: {
[key: string]: string;
} | null;
/**
* The object that describes Flex UI characteristics and settings
*/
uiAttributes: TUI;
/**
* The primary language of the Flex UI
*/
uiLanguage: string | null;
/**
* The Pinned UI version
*/
uiVersion: string;
queueStatsConfiguration: QueueStatsConfiguration | null;
/**
* The absolute URL of the Configuration resource
*/
url: string;
}
/**
* Options for fetching Flex account configuration.
* @public
*/
export declare interface AccountConfigOptions {
query?: {
UiVersion?: string;
};
}
/**
* Account sid option
* @public
*/
export declare interface AccountSidOption {
/**
* Account sid
*/
accountSid: string;
}
/**
* Generic interface for executable actions in the Flex SDK.
* Actions represent operations that can be performed on Flex resources
* such as tasks, reservations, or participants.
*
* @example
* ```ts
* import type { Action, TaskReservation } from "@twilio/flex-sdk";
* import { createClient, AcceptTask } from "@twilio/flex-sdk";
*
* async function runAction() {
* const client = await createClient("SDK_TOKEN");
* const action: Action> = new AcceptTask("TASK_SID");
* await client.execute(action);
* }
* ```
*
* @public
*/
export declare interface Action {
run(ctx: {}): T;
}
export { Activity }
export { ActivityOptions }
/**
* Adds a conversation event listener to the client.
* @category Actions
*
* @param eventName - The name of the event to listen for (e.g. "conversationAdded").
* @param listener - The event listener function to be called when the event occurs.
*
* @returns A promise that resolves to an object containing the unsubscribe function to remove the listener.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToAddConversationEventListener}
* - {@link ErrorCode.FailedToInitializeConversationsSDK}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { AddConversationEventListener } from "@twilio/flex-sdk/actions/Conversation";
*
* async function addConversationEventListener() {
* const client = await createClient("SDK_TOKEN");
*
* const addConversationEventListener = new AddConversationEventListener("conversationAdded", (conversation) => {
* // Handle incoming conversation
* });
* const result = await client.execute(addConversationEventListener);
* return result;
* }
* ```
*
* @public
*/
export declare class AddConversationEventListener implements Action> {
constructor(eventName: T, listener: ConversationClientEvents[T]);
run(ctx: {}): Promise<{
unsubscribe: () => void;
}>;
}
/**
* @public
*/
export declare interface AddConversationEventListenerResponse {
/**
* Unsubscribe function to remove the event listener.
*/
unsubscribe: () => void;
}
/**
* Adds a participant to an email task.
* @category Actions
*
* @param taskSid - The SID of the email task to add the participant to.
* @param email - The email address of the participant to add.
* @param level - The level of the participant to add, which should be either {@link ParticipantLevel.To} or {@link ParticipantLevel.CC}.
* @param options - Additional options for the participant, containing the 'name' field which is the friendly name for the participant to be added.
*
* @returns A promise that resolves when the participant is successfully added.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToAddEmailParticipant}
* - {@link ErrorCode.TaskNotEmailTask}
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { AddEmailParticipant, ParticipantLevel } from "@twilio/flex-sdk/actions/Conversation";
*
* async function addEmailParticipant() {
* const client = await createClient("SDK_TOKEN");
* const addEmailParticipant = new AddEmailParticipant("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "test.user@gmail.com", ParticipantLevel.To, { name: "Test User" });
* await client.execute(addEmailParticipant);
* }
* ```
*
* @public
*/
export declare class AddEmailParticipant implements Action> {
constructor(taskSid: string, email: string, level: ParticipantLevel, options?: AddEmailParticipantOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface AddEmailParticipantOptions {
name: string;
}
/**
* Adds a participant to a voice task.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the voice task to add the participant to.
* @param phoneNumber - The phone number of the participant to be added.
* @param options - An optional parameter for specifying additional options for the participant.
*
* @returns A promise that resolves to an `AddVoiceParticipantResponse` object, indicating the result of the participant addition operation.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.CallerIdUndefined}
* - {@link ErrorCode.FailedToAddExternalVoiceParticipant}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.MissingRequiredParameter}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { AddExternalVoiceParticipant } from "@twilio/flex-sdk/actions/Voice";
*
* async function addExternalVoiceParticipant() {
* const client = await createClient("SDK_TOKEN");
* const addParticipant = new AddExternalVoiceParticipant(
* "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* "+1234567890"
* );
* const { pendingParticipantResponse, waitForParticipantToSettle } = await client.execute(addParticipant);
* return { pendingParticipantResponse, waitForParticipantToSettle };
* }
* ```
* @example When initializing the SDK with custom Worker
* ```ts
* import {
* createClient,
* AddExternalVoiceParticipant,
* TaskParticipant,
* } from "@twilio/flex-sdk";
* import { Worker } from "@twilio/flex-sdk/taskrouter";
*
* async function addExternalVoiceParticipantWithCustomWorker() {
* const TOKEN = "SDK_TOKEN";
*
* const worker = new Worker(TOKEN);
* const client = await createClient(TOKEN, { worker });
*
* const addParticipant = new AddExternalVoiceParticipant(
* "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* "+1234567890"
* );
* const { pendingParticipantResponse, waitForParticipantToSettle } =
* await client.execute(addParticipant);
*
* console.log(pendingParticipantResponse);
* waitForParticipantToSettle
* .then((participant: TaskParticipant) =>
* console.log("waitForParticipantToSettle", participant)
* )
* .catch((err) => console.log("waitForParticipantToSettle", err));
*
* return { pendingParticipantResponse, waitForParticipantToSettle };
* }
* ```
*
* @public
*/
export declare class AddExternalVoiceParticipant implements Action> {
constructor(taskSid: string, phoneNumber: string, options?: AddExternalVoiceParticipantOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface AddExternalVoiceParticipantOptions extends AddVoiceParticipantOptions {
callerId?: string;
}
/**
* Adds a task participant event listener.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task.
* @param eventName - The event name (e.g. participantAdded).
* @param listener - The event listener function.
*
* @returns A promise that resolves to an object containing the unsubscribe function to remove the listener.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { AddTaskParticipantListener } from "@twilio/flex-sdk/actions/Task";
*
* async function addTaskParticipantListener() {
* const client = await createClient("SDK_TOKEN");
*
* const addTaskParticipantListener = new AddTaskParticipantListener(
* "WTxxx",
* "participantAdded",
* (task, participant) => {
* console.log(`Participant added: ${participant.sid} to task ${task.sid}`);
* }
* );
* const { unsubscribe } = await client.execute(addTaskParticipantListener);
* return unsubscribe;
* }
* ```
*
* @public
*/
export declare class AddTaskParticipantListener implements Action> {
constructor(taskSid: string, eventName: T, listener: TaskParticipantEvent[T]);
run(ctx: {}): Promise<{
unsubscribe: () => Task;
}>;
}
/**
* @public
*/
export declare interface AddTaskParticipantListenerResponse {
/**
* Unsubscribe function to remove the event listener.
*/
unsubscribe: () => void;
}
/**
* Adds a voice event listener to the client.
* @category Actions
*
* @param eventName - The event name (e.g. "incoming" or VoiceClientEvent.Incoming).
* @param listener - The event listener function.
* @param options - Optional parameters for adding the event listener, containing an optional custom voice device.
*
* @returns A promise which resolves to an object containing the unsubscribe function to remove the listener.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.VoiceDeviceNotInitialized}
* - {@link ErrorCode.UnknownVoiceEventName}
* - {@link ErrorCode.FailedToAddVoiceEventListener}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { AddVoiceEventListener, VoiceClientEvent } from "@twilio/flex-sdk/actions/Voice";
*
* const client = await createClient("SDK_TOKEN");
*
* const addVoiceEventListener = new AddVoiceEventListener(VoiceClientEvent.Incoming, (call) => {
* // Handle incoming call
* });
* const { unsubscribe } = await client.execute(addVoiceEventListener);
*
* // call unsubscribe if defined to remove the listener when needed
* unsubscribe();
* ```
*
* @public
*/
export declare class AddVoiceEventListener implements Action> {
constructor(eventName: T, listener: AddVoiceListenerEvent[T], options?: AddVoiceEventListenerOptions);
run(ctx: {}): Promise<{
unsubscribe: () => void;
}>;
}
/**
* @public
*/
export declare interface AddVoiceEventListenerOptions {
voiceDevice?: Device;
}
/**
* @public
*/
export declare interface AddVoiceEventListenerResponse {
/**
* Unsubscribe function to remove the event listener.
*/
unsubscribe: () => void;
}
/**
* @public
*/
export declare interface AddVoiceListenerEvent {
incoming: (call: VoiceCall) => void;
error: (error: Error, call?: VoiceCall) => void;
destroyed: () => void;
tokenWillExpire: () => void;
unregistered: () => void;
}
/**
* Media properties for add voice participant
* @public
*/
export declare type AddVoiceParticipantMediaProperties = {
call?: ParticipantCallProperties;
callSid?: string;
muted?: boolean;
beep?: string;
startConferenceOnEnter?: boolean;
endConferenceOnExit?: boolean;
coaching?: boolean;
hold?: boolean;
callSidToCoach?: string;
earlyMedia?: boolean;
waitUrl?: string;
waitMethod?: 'GET' | 'POST';
transcribe?: boolean;
transcriptionConfiguration?: string;
jitterBufferSize?: string;
};
/**
* Add voice participant options
* @public
*/
export declare type AddVoiceParticipantOptions = {
/**
* Type of the voice participant, 'agent', 'customer', 'supervisor' or 'external'
*/
type: ParticipantType;
/**
* The phone number the call is made from
*/
from: string;
/**
* The phone number to call to
*/
to: string;
/**
* Routing properties for the Agent participant
*/
routingProperties?: RoutingProperties;
/**
* Media properties for the Agent participant
*/
mediaProperties?: AddVoiceParticipantMediaProperties;
};
/**
* Response returned when adding a voice participant to a task.
* @public
*/
export declare interface AddVoiceParticipantResponse {
/**
* Response for the adding participant request.
*/
pendingParticipantResponse: {
/**
* The identifier of the participant who is added to the channel
*/
sid: string;
/**
* The channel sid of the channel where the participant is added
*/
channelSid: string;
/**
* The identifier of the interaction where the participant is added
*/
interactionSid: string;
/**
* Optional media properties of the participant
*/
mediaProperties: MediaProperties | null;
};
/**
* Wait for the success or failure event for adding a Participant.
*/
waitForParticipantToSettle: Promise;
}
/**
* Application types supported for authentication.
* @public
*/
export declare type AppType = "SinglePageApp" | "MobileApp";
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Attachments configuration
* @public
*/
export declare interface Attachments {
enabled: boolean;
/**
* Max number of attachments
*/
number_of_attachments: number;
/**
* Max size of 1 attachment
*/
max_file_size: number;
/**
* Max total size of attachments
*/
max_total_file_size: number;
/**
* Accepted attachment extensions
*/
accepted_extensions: Array;
}
/**
* Configuration for authentication to Twilio Flex.
* @public
*/
export declare interface AuthenticationConfig {
accountSid: string;
instanceSid: string;
connectionName: string;
clientId: string;
active: boolean;
appType: AppType;
ssoProfileSid: string;
}
/**
* Parameters for retrieving authentication configuration.
* @public
*/
export declare interface AuthenticationConfigParams {
accountSid?: string;
instanceSid?: string;
runtimeDomain?: string;
ssoProfileSid?: string;
appType?: AppType;
}
/**
* Response containing a list of available authentication configurations.
* @public
*/
export declare interface AuthenticationConfigResponse {
configList: Array;
}
/**
* Properties which both {@link VoiceTaskParticipant} and {@link ConversationTaskParticipant} types have in common.
* @public
*/
export declare interface BaseParticipant {
/**
* The sid of the participant (UTxxx)
*/
readonly participantSid: string;
/**
* The type of the participant
*/
readonly type: ParticipantType;
/**
* The sid of the channel (UOxxx)
*/
readonly channelSid: string;
/**
* The sid of the interaction (KDxxx)
*/
readonly interactionSid: string;
/**
* The routing properties of the participant
*/
readonly routingProperties?: RoutingProperties | null;
readonly errorData: {
errorMessage: string;
errorCode: number;
} | null;
}
export { CallOptions }
/**
* Cancels a voice task transfer.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to be transferred.
*
* @returns A promise that resolves to a `Task` object, representing the canceled task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.NoActiveTransferForVoiceTask}
* - {@link ErrorCode.FailedToCancelVoiceTaskTransfer}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.TaskNotVoiceTask}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { CancelVoiceTaskTransfer } from "@twilio/flex-sdk/actions/Voice";
*
* async function cancelVoiceTaskTransfer() {
* const client = await createClient("SDK_TOKEN");
* const cancelVoiceTaskTransfer = new CancelVoiceTaskTransfer("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const canceledTask = await client.execute(cancelVoiceTaskTransfer);
* return canceledTask;
* }
* ```
*
* @public
*/
export declare class CancelVoiceTaskTransfer implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise;
}
export { Channel }
/**
* Channel configuration object
* @public
*/
export declare interface ChannelConfig {
/**
* Type of channel
*/
address_type: string;
cbm_attachments: Attachments;
}
export { ChannelEvents }
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Enable Voice on Citrix VDI
* @public
*/
export declare interface CitrixVoiceVdi {
enabled: boolean;
}
/**
* Main interface for interacting with the Flex SDK.
* @public
*/
export declare interface Client extends TypedEmitter {
readonly roles: Array;
readonly token: string;
/**
* @returns Worker object representing the current user. If the worker is already initialized, it will return immediately.
*/
getWorker: () => Promise;
/**
* @returns Workspace object. If the workspace is already initialized, it will return immediately.
*/
getWorkspace: () => Promise;
execute(action: Action): T;
/**
* Destroy the client, removing all event listeners
* @returns {Promise}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
*
* await client.destroy();
* ```
*/
destroy(): void;
/**
*
* Update the token for the client
* @param token - The new token
*
* @returns
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
*
* client.updateToken("NEW_TOKEN");
* ```
*/
updateToken(token: string): void;
}
/**
* Enumeration of event names that the Flex SDK client can emit.
* @public
*/
export declare enum ClientEvent {
TokenUpdated = "tokenUpdated",
TokenAutoUpdateFailed = "tokenAutoUpdateFailed",
TokenMaxLifetimeReached = "tokenMaxLifetimeReached",
ClientDestroyed = "clientDestroyed"
}
/**
* Events that the Flex SDK client can emit.
* @public
*/
export declare interface ClientEventsType {
tokenUpdated: (token: string) => void;
tokenAutoUpdateFailed: () => void;
tokenMaxLifetimeReached: (newTokenDateExpired: Date) => void;
clientDestroyed: () => void;
[key: string]: (...args: any[]) => void;
}
/**
* Options for configuring the Flex SDK client.
* @public
*/
export declare interface ClientOptions {
/**
* Session related options
*/
session: SessionOptions;
/**
* Logger related options
*/
logger: LoggerOptions;
/**
* Account config related options
*/
accountConfig: AccountConfigOptions;
/**
* TaskRouter-related options
*/
taskRouterOptions?: TaskRouterOptions;
/**
* Voice related options
*/
voiceOptions?: VoiceOptions;
/**
* Twilio Region ID, e.g. "us1", "ie1" etc
*/
region: string;
/**
* region value to use for non-Flex apis
*/
regionNonFlex?: string;
/**
* Name of the app that is using Flex SDK, e.g. "My Custom App"
*/
appName: string;
/**
* Version of the app that is using Flex SDK, e.g. "2.3"
*/
appVersion: string;
worker?: Supervisor;
workspace?: Workspace;
/**
* Type of the app using SDK, e.g. "mobile", "web" or "headless". "headless" is used by default
*/
origin?: string;
/**
* By default FlexSDK collects usage information that gets used
* for improving the SDK and providing better support.
*/
telemetryOptions?: TelemetryOptions;
}
/**
* Completes a task that is either pending or assigned.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to be completed.
*
* @returns A promise that resolves to a `Task` object, representing the completed task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToRemoveParticipant}
* - {@link ErrorCode.FailedToCompleteReservation}
* - {@link ErrorCode.WorkerParticipantNotFoundForTask}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.FailedToRetrieveTaskParticipants}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { CompleteTask } from "@twilio/flex-sdk/actions/Task";
*
* async function completeTask() {
* const client = await createClient("SDK_TOKEN");
*
* const completeTask = new CompleteTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const completedTask = await client.execute(completeTask);
* return completedTask;
* }
* ```
*
* @public
*/
export declare class CompleteTask implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise;
}
export { ConferenceOptions }
/**
* Interface containing information about connection errors encountered when interacting with Twilio Conversations.
* @public
*/
export declare interface ConnectionError {
terminal: boolean;
message: string;
}
/**
* Parameters for exchanging authorization code for a token in Twilio Console authentication flow.
* @public
*/
export declare interface ConsoleExchangeTokenParams {
/**
* App type. This is needed if it was provided in the initial authentication request.
*/
appType?: AppType;
/**
* Account for which the auth code was obtained.
*/
accountSid?: string;
/**
* Flex instance for which the auth code was obtained.
*/
instanceSid?: string;
/**
* Auth code, required with authorization_code grant
*/
code: string;
/**
* Code verifier (PKCE), required with authorization_code grant.
*/
codeVerifier: string;
/**
* Nonce, required with authorization_code grant.
*/
nonce: string;
/**
* Flag indicating console login (Must be true for console login)
*/
isConsoleLogin: true;
}
/**
* Parameters for generating Twilio Console login details and authentication URLs.
* @public
*/
export declare interface ConsoleLoginDetailsParams {
/**
* The connection id for the specific account (obtained via the getAccountConfig).
*/
clientId: string;
/**
* Flag indicating console login (Must be true for console login)
*/
isConsoleLogin: true;
/**
* Account for which the auth code was obtained.
*/
accountSid?: string;
/**
* Flex instance for which the auth code was obtained.
*/
instanceSid?: string;
/**
* App type. This is needed if it was provided in the initial authentication request.
*/
appType?: AppType;
/**
* Redirect url where to return back after the identity provider user authentication.
*/
redirectUrl?: string;
}
/**
* Options for Twilio Console authentication.
* @public
*/
export declare interface ConsoleSessionOptions {
readonly autoUpdateToken: true;
readonly isConsoleLogin: true;
readonly refreshToken: string;
readonly accountSid: string;
readonly instanceSid: string;
readonly appType?: AppType;
}
/**
* Interface for managing a Twilio Conversation.
*
* To listen for events in a particular conversation, we can use the conversation.conversation property, which is an instance of `TwilioConversation`.
* @example
* ```ts
* import { createClient, SendTextMessageOptions } from "@twilio/flex-sdk";
* import { AddConversationEventListener } from "@twilio/flex-sdk/actions/Conversation";
*
* async function subscribeToNewMessages() {
* const client = await createClient("SDK_TOKEN");
* const conversationListener = new AddConversationEventListener("conversationAdded", (conversation) => {
* conversation.conversation.on("messageAdded", (message) => {
* console.log(`New message in conversation ${conversation.sid}:`, message);
* });
* const messageOptions: SendTextMessageOptions = {
* body: "Hello, world!"
* };
* await conversation.sendMessage(messageOptions);
* });
* const { unsubscribe } = await client.execute(conversationListener);
* }
* ```
*
* @public
*/
export declare interface Conversation {
sid: string;
conversation: TwilioConversation;
/**
* Send a message to a conversation.
* @param messageOptions - passed message either as a {@link SendTextMessageOptions} or {@link SendEmailMessageOptions}
*
* @returns A message index in conversation or a null.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToSendMessage}
* - {@link ErrorCode.MessageContentMissing}
* - {@link ErrorCode.ConversationNotAvailable}
*
* @example
* ```ts
* import { createClient, AddConversationEventListener } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
*
* const addConversationEventListener = new AddConversationEventListener("conversationAdded", (conversation) => {
* conversation.sendMessage({body: "hello world!"});
* })
* client.execute(addConversationEventListener)
*
* ```
*
* @public
*/
sendMessage(messageOptions: SendTextMessageOptions | SendEmailMessageOptions): Promise;
/**
*
* Get a list of messages from a conversation.
* @param pageSize - number of messages per page.
* @param anchorMessageIndex - message index to rely on when fetching the messages. Depending on direction will either get messages until, or after this anchorMessageIndex index.
* @param direction - direction in which the messages will be sorted - last to first or vice versa.
*
* @returns Pages with messages.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToRetrieveMessages}
* - {@link ErrorCode.ConversationNotAvailable}
*
* @example
* ```ts
* import { createClient, AddConversationEventListener } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
*
* const addConversationEventListener = new AddConversationEventListener("conversationAdded", (conversation) => {
* conversation.getMessages();
* })
* client.execute(addConversationEventListener)
*
* ```
*
* @public
*/
getMessages(pageSize?: number, anchorMessageIndex?: number, direction?: MessagesDirection): Promise>;
/**
* Send that worker is currently typing
* @returns Promise which resolves when the operation is completed
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToSendTypingIndicator}
* - {@link ErrorCode.ConversationNotAvailable}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetConversationByTask } from "@twilio/flex-sdk/actions/Conversation";
*
* const client = await createClient("SDK_TOKEN");
* const getConversationByTask = new GetConversationByTask(
* "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* );
* const conversation = await client.execute(getConversationByTask);
* await conversation.sendTyping();
* ```
*
* @public
*/
sendTyping(): Promise;
}
/**
* Enumeration of conversation event names that the Flex SDK client can listen to.
* @public
*/
export declare enum ConversationClientEvent {
ConversationAdded = "conversationAdded",
ConversationJoined = "conversationJoined",
ConversationLeft = "conversationLeft",
ConversationRemoved = "conversationRemoved",
ConversationUpdated = "conversationUpdated",
ParticipantJoined = "participantJoined",
ParticipantLeft = "participantLeft",
ParticipantUpdated = "participantUpdated",
MessageAdded = "messageAdded",
MessageRemoved = "messageRemoved",
MessageUpdated = "messageUpdated",
TokenAboutToExpire = "tokenAboutToExpire",
TokenExpired = "tokenExpired",
TypingEnded = "typingEnded",
TypingStarted = "typingStarted",
PushNotification = "pushNotification",
UserSubscribed = "userSubscribed",
UserUnsubscribed = "userUnsubscribed",
UserUpdated = "userUpdated",
StateChanged = "stateChanged",
Initialized = "initialized",
InitFailed = "initFailed",
ConnectionStateChanged = "connectionStateChanged",
ConnectionError = "connectionError"
}
/**
* @public
*/
export declare interface ConversationClientEvents {
conversationAdded: (conversation: Conversation) => void;
conversationJoined: (conversation: Conversation) => void;
conversationLeft: (conversation: Conversation) => void;
conversationRemoved: (conversation: Conversation) => void;
conversationUpdated: (data: {
conversation: Conversation;
updateReasons: ConversationUpdateReason[];
}) => void;
participantJoined: (participant: ConversationParticipant) => void;
participantLeft: (participant: ConversationParticipant) => void;
participantUpdated: (data: {
participant: ConversationParticipant;
updateReasons: ConversationParticipantUpdateReason[];
}) => void;
messageAdded: (message: Message) => void;
messageRemoved: (message: Message) => void;
messageUpdated: (data: {
message: Message;
updateReasons: MessageUpdateReason[];
}) => void;
tokenAboutToExpire: () => void;
tokenExpired: () => void;
typingEnded: (participant: ConversationParticipant) => void;
typingStarted: (participant: ConversationParticipant) => void;
pushNotification: (pushNotification: PushNotification) => void;
userSubscribed: (user: ConversationsUser) => void;
userUnsubscribed: (user: ConversationsUser) => void;
userUpdated: (data: {
user: ConversationsUser;
updateReasons: UserUpdateReason[];
}) => void;
initialized: () => void;
initFailed: (data: {
error?: ConnectionError;
}) => void;
connectionStateChanged: (state: TwilsockConnectionState) => void;
connectionError: (data: ConnectionError) => void;
}
/**
* Media properties for conversation participants.
* @public
*/
export declare type ConversationMediaProperties = {
conversationSid: string;
friendlyName: string | null;
dateUpdated: string;
roleSid: string;
chatbotConfiguration: {
friendlyName: string | null;
chatbotProvider: string | null;
configuration: {
dialogflowcxModuleSid: string | null;
dialogflowcxAddonSid: string | null;
};
} | null;
dateCreated: string;
chatServiceSid: string;
url: string;
sid: string;
lastReadMessageIndex: number | null;
identity: string | null;
lastReadTimestamp: string | null;
messagingBinding: {
address: string;
level: ParticipantLevel | null;
proxyAddress: string | null;
name: string | null;
type: string;
projectedAddress: string | null;
} | null;
accountSid: string;
attributes: string;
} & MediaProperties;
export { ConversationParticipant }
export { ConversationParticipantType }
export { ConversationParticipantUpdateReason }
export { ConversationsClient }
export { ConversationStatus }
export { ConversationsUser }
/**
* Extends {@link BaseParticipant} with properties specific to conversation participants.
* @public
*/
export declare type ConversationTaskParticipant = BaseParticipant & {
/**
* The type of the channel
*/
readonly channelType: Exclude;
/**
* Media properties of the participant
*/
readonly mediaProperties?: ConversationMediaProperties | null;
};
/**
* @public
*/
export declare interface ConversationTransfer {
sid: string;
channelSid: string;
type: string;
from: string;
to: string;
status: string;
reason: string;
dateCreated: Date;
summary?: string;
}
export { ConversationUpdateReason }
/**
* Creates a new FlexSdk Client instance.
*
* @param token - A flex token to initialize the client
* @param userOptions - A set of options to configure the client
*
* @returns a Promise that resolves with the new Client instance
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN", {
* logger: {
* level: "debug"
* }
* });
* ```
*
* @public
*/
export declare const createClient: (token: string, userOptions?: DeepPartial) => Promise;
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Debugger integration configuration
* @public
*/
export declare interface DebuggerIntegration {
console_errors_included?: boolean;
enabled: boolean;
}
/**
* @public
*/
export declare type DeepPartial = {
[P in keyof T]?: DeepPartial | T[P];
};
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* default configuration
* @public
*/
export declare interface DefaultQueueStatsConfiguration {
service_level_threshold?: number;
short_abandoned_threshold?: number;
reset_timezone?: string;
reset_time?: string;
}
/**
* Default session options, includes the `autoUpdateToken` property set to `false`.
* @public
*/
export declare interface DefaultSessionOptions {
readonly autoUpdateToken: false;
}
export { DeliveryStatus }
export { DequeueOptions }
/**
* Ends a task.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to be ended.
*
* @returns A promise that resolves to a `Reservation` and a `Task` object, representing the ended task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToEndTask}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { EndTask } from "@twilio/flex-sdk/actions/Task";
*
* async function endTask() {
* const client = await createClient("SDK_TOKEN");
* const endTask = new EndTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const { task, reservation } = await client.execute(endTask);
* return { task, reservation };
* }
* ```
*
* @public
*/
export declare class EndTask implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise<{
task: Task;
reservation: Reservation;
}>;
}
/**
* Ends a call for all participants.
*
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to be ended.
*
* @returns A promise that resolves to a `Task` object, representing the ended task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToEndConference}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { EndVoiceCallForAll } from "@twilio/flex-sdk/actions/Voice";
*
* async function endVoiceCallForAll() {
* const client = await createClient("SDK_TOKEN");
* const endVoiceCallForAll = new EndVoiceCallForAll("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const endedTask = await client.execute(endVoiceCallForAll);
* return endedTask;
* }
* ```
*
* @public
*/
export declare class EndVoiceCallForAll implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise;
}
/**
* Enumeration of error codes that can be thrown by the Flex SDK.
* @public
*/
export declare enum ErrorCode {
/**
* PermissionDenied error
*/
PermissionDeniedError = 20003,
/**
* Invalid access token
*/
InvalidAccessToken = 20101,
/**
* Access Token expired or expiration date invalid
*/
AccessTokenExpired = 20104,
/**
* Twilsock rate limit exceeded
*/
TooManyRequests = 20429,
/**
* Internal Server Error
*/
InternalServerError = 20500,
/**
* Service Unavailable
*/
ServiceUnavailable = 20503,
/**
* Authorization error, public error code in Flex product
*/
AuthorizationError = 45003,
/**
* Validation error, public error code in Flex product
*/
ValidationError = 45004,
/**
* Failed to remove participant during task completion
*/
FailedToRemoveParticipant = 48100,
/**
* Failed to complete reservation during task completion
*/
FailedToCompleteReservation = 48101,
/**
* Failed to end task due to internal error
*/
FailedToEndTask = 48102,
/**
* Failed to reject reservation due to internal error
*/
FailedToRejectReservation = 48103,
/**
* Failed to wrap-up reservation due to internal error
*/
FailedToWrapUpReservation = 48104,
/**
* Failed to set task attributes
*/
FailedToSetTaskAttributes = 48105,
/**
* Failed to set activity due to pending reservations
*/
FailedToSetCurrentWorkerActivityDueToPendingReservations = 48200,
/**
* Failed to set activity
*/
FailedToSetCurrentWorkerActivity = 48201,
/**
* Failed to set current worker attributes
*/
FailedToSetCurrentWorkerAttributes = 48202,
/**
* Failed to set worker activity by the supervisor
*/
FailedToSetWorkerActivityBySupervisor = 48300,
/**
* Activity change rejected due to pending tasks
*/
ActivityChangeRejectedPendingReservations = 48301,
/**
* Attributes not valid JSON
*/
FailedToSetWorkerAttributesBySupervisor = 48302,
/**
* Caller ID undefined
*/
CallerIdUndefined = 48400,
/**
* Failed to add external voice participant due to internal error
*/
FailedToAddExternalVoiceParticipant = 48401,
/**
* Failed to end conference due to internal error
*/
FailedToEndConference = 48402,
/**
* Failed to hold external participant due to internal error
*/
FailedToHoldExternalParticipant = 48403,
/**
* Failed to hold worker participant due to internal error
*/
FailedToHoldWorkerParticipant = 48404,
/**
* Failed to hold participant due to internal error
*/
FailedToHoldVoiceParticipant = 48405,
/**
* Worker cannot kick themselves from task
*/
FailedSelfKick = 48406,
/**
* Failed to kick participant due to internal error
*/
FailedToKickVoiceParticipant = 48407,
/**
* Failed to unhold external participant due to internal error
*/
FailedToUnholdExternalParticipant = 48408,
/**
* Failed to unhold worker participant due to internal error
*/
FailedToUnholdWorkerParticipant = 48409,
/**
* Failed to unhold participant due to internal error
*/
FailedToUnholdVoiceParticipant = 48410,
/**
* Worker cannot unhold reservation - reservation must be a live call assigned to the worker
*/
WorkerCannotUnholdReservation = 48411,
/**
* Worker cannot hold reservation - reservation must be a live call assigned to the worker
*/
WorkerCannotHoldReservation = 48412,
/**
* Invalid participantSid provided
*/
InvalidParticipantSid = 48413,
/**
* Voice device not initialized
*/
VoiceDeviceNotInitialized = 48414,
/**
* Unknown voice event name
*/
UnknownVoiceEventName = 48415,
/**
* Failed to add voice event listener due to internal error
*/
FailedToAddVoiceEventListener = 48416,
/**
* Failed to get call by task - call might be active on different device
*/
FailedToGetCallByTask = 48417,
/**
* Failed to get conference data from task
*/
FailedToGetConferenceData = 48418,
/**
* Supervisor is already monitoring the call for this task
*/
SupervisorAlreadyMonitoringCall = 48419,
/**
* Failed to monitor call due to internal error
*/
FailedToMonitorCall = 48420,
/**
* Parameter 'fromNumber' is required for outbound call. Provide it as a parameter or configure it in account configuration
*/
FromNumberRequired = 48421,
/**
* Task Queue SID is required for outbound call. Provide it as a parameter or configure it in account configuration
*/
TaskQueueSidRequired = 48422,
/**
* Workflow SID is required for outbound call. Provide it as a parameter or configure it in account configuration
*/
WorkflowSidRequired = 48423,
/**
* Worker is offline, outbound call cancelled
*/
WorkerOfflineOutboundCallCancelled = 48424,
/**
* Outbound calling is disabled in Flex account configuration
*/
OutboundCallingDisabled = 48425,
/**
* Inbound call is pending, outbound call cancelled
*/
InboundCallPendingOutboundCancelled = 48426,
/**
* Inbound call is accepted, outbound call cancelled
*/
InboundCallAcceptedOutboundCancelled = 48427,
/**
* No audio input device available, outbound call cancelled
*/
NoAudioInputDeviceAvailable = 48428,
/**
* No incoming call event received within 30 seconds
*/
IncomingCallTimeout = 48429,
/**
* Failed to create task due to internal error
*/
FailedToCreateTask = 48430,
/**
* Failed to disconnect call due to internal error
*/
FailedToDisconnectCall = 48431,
/**
* Voice reservation not a live call
*/
VoiceReservationNotLiveCall = 48432,
/**
* No conference SID found in task attributes
*/
NoConferenceSidFoundInTaskAttributes = 48433,
/**
* No active recording to pause
*/
NoActiveRecordingToPause = 48434,
/**
* Failed to pause recording
*/
FailedToPauseRecording = 48435,
/**
* No active recording to resume
*/
NoActiveRecordingToResume = 48436,
/**
* Failed to resume recording
*/
FailedToResumeRecording = 48437,
/**
* Call instance is undefined. Call might be active on a different device
*/
CallInstanceUndefined = 48438,
/**
* Failed to hold call
*/
FailedToHoldCall = 48439,
/**
* Failed to unhold call
*/
FailedToUnholdCall = 48440,
/**
* No active transfer found for voice task
*/
NoActiveTransferForVoiceTask = 48441,
/**
* Failed to cancel voice task transfer due to internal error
*/
FailedToCancelVoiceTaskTransfer = 48442,
/**
* Voice task transfer already initiated
*/
VoiceTaskTransferAlreadyInitiated = 48443,
/**
* Worker cannot transfer voice task assigned to different worker
*/
WorkerCannotTransferVoiceTaskFromDifferentWorker = 48444,
/**
* Failed to start voice task transfer due to internal error
*/
FailedToStartVoiceTaskTransfer = 48445,
/**
* Failed to create voice task reservation
*/
FailedToCreateVoiceTaskReservation = 48446,
/**
* Voice reservation not found
*/
VoiceReservationNotFound = 48447,
/**
* Failed to peek conversation due to internal error
*/
FailedToPeekConversation = 48500,
/**
* Failed to pause conversation due to internal error
*/
FailedToPauseConversation = 48501,
/**
* Failed to resume conversation due to internal error
*/
FailedToResumeConversation = 48502,
/**
* Failed to leave conversation due to internal error
*/
FailedToLeaveConversation = 48503,
/**
* Failed to start conversation transfer due to internal error
*/
FailedToStartConversationTransfer = 48504,
/**
* Conversation transfers is forbidden
*/
ConversationTransferForbidden = 48505,
/**
* Conversation transfers retrieving is forbidden
*/
ConversationTransferRetrievingForbidden = 48506,
/**
* Failed to retrieve conversation transfer due to internal error
*/
FailedToRetrieveConversationTransfer = 48507,
/**
* Failed to retrieve conversations user by identity
*/
FailedToRetrieveConversationsUser = 48508,
/**
* Failed to send message due to internal error
*/
FailedToSendMessage = 48509,
/**
* Failed to send typing indicator due to internal error
*/
FailedToSendTypingIndicator = 48510,
/**
* Failed to retrieve messages due to internal error
*/
FailedToRetrieveMessages = 48511,
/**
* Worker is offline, outbound email task cancelled
*/
WorkerOfflineEmailTaskCancelled = 48512,
/**
* Failed to create outbound email task due to internal error
*/
FailedToCreateOutboundEmailTask = 48513,
/**
* Failed to add email participant due to internal error
*/
FailedToAddEmailParticipant = 48514,
/**
* Task is not an email task
*/
TaskNotEmailTask = 48515,
/**
* Failed to remove email participant due to internal error
*/
FailedToRemoveEmailParticipant = 48516,
/**
* Failed to retrieve paused conversations due to internal error
*/
FailedToRetrievePausedConversations = 48517,
/**
* No conversationSid found for task
*/
NoConversationSidFoundForTask = 48518,
/**
* Failed to get reservation after resuming the conversation
*/
FailedToGetReservationAfterConversationResuming = 48519,
/**
* Worker participant not found for provided task
*/
WorkerParticipantNotFoundForTask = 48520,
/**
* Cannot send empty message
*/
MessageContentMissing = 48521,
/**
* Failed to retrieve outbound email settings due to internal error
*/
FailedToRetrieveOutboundEmailSettings = 48522,
/**
* Outbound email workflow SID is not configured in Twilio Console nor provided in options
*/
OutboundEmailWorkflowSidUndefined = 48523,
/**
* Outbound email queue SID is not configured in Twilio Console nor provided in options
*/
OutboundEmailQueueSidUndefined = 48524,
/**
* Outbound email workflow SID is not configured in Twilio Console nor provided in options
*/
OutboundEmailFromParameterUndefined = 48525,
/**
* Failed to create conversation task reservation
*/
FailedToCreateOutboundEmailTaskReservation = 48526,
/**
* Failed to add conversation event listener due to internal error
*/
FailedToAddConversationEventListener = 48527,
/**
* Conversations SDK connection changed to invalid state
*/
ConversationsSdkConnectionInvalidState = 48528,
/**
* Worker is not initialized
*/
WorkerNotInitialized = 48900,
/**
* Task reservation not found or has invalid status
*/
TaskReservationNotFound = 48901,
/**
* Required parameter missing
*/
MissingRequiredParameter = 48902,
/**
* Conversation is not available
*/
ConversationNotAvailable = 48903,
/**
* Participant not found
*/
ParticipantNotFound = 48904,
/**
* Failed to update token on session
*/
FailedToUpdateTokenOnSession = 48905,
/**
* Failed to initialize Conversations SDK
*/
FailedToInitializeConversationsSDK = 48906,
/**
* Missing interactionSid for task
*/
MissingTaskInteractionSid = 48907,
/**
* Missing channelSid for task
*/
MissingChannelSid = 48908,
/**
* Invalid response from public configuration endpoint
*/
InvalidResponseFromPublicConfig = 48909,
/**
* Failed to accept reservation
*/
FailedToAcceptReservation = 48910,
/**
* Failed to retrieve conversation due to internal error
*/
FailedToRetrieveConversation = 48911,
/**
* Failed to get Flex instance SID from account configuration
*/
FailedToGetFlexInstanceSid = 48912,
/**
* Failed to retrieve task participants due to internal error
*/
FailedToRetrieveTaskParticipants = 48913,
/**
* Active channel not found for task
*/
ActiveChannelNotFound = 48914,
/**
* Task is not a voice task
*/
TaskNotVoiceTask = 48915,
/**
* Taskrouter offline activity SID is not configured
*/
TaskrouterOfflineActivitySidNotConfigured = 48916,
/**
* Failed to create a conference
*/
FailedToCreateConference = 48917,
/**
* The error we did not foreseen
*/
UnexpectedError = 48918,
/**
* The error which error code we could not identify
*/
UnknownError = 48919,
/**
* Access denied
*/
AccessDeniedError = 48920,
/**
* Bad Gateway
*/
BadGateway = 48921,
/**
* Gateway Timeout
*/
GatewayTimeout = 48922,
/**
* Resource was not found
*/
NotFound = 48923,
/**
* Not able to reach the server
*/
NetworkError = 48924,
/**
* Function called in invalid state of the object
*/
InvalidState = 48925,
/**
* Invalid parameter value received as argument
*/
InvalidParams = 48926,
/**
* DownstreamServiceError error
*/
DownstreamServiceError = 48927,
/**
* Failed to fetch account configuration
*/
FailedToFetchAccountConfiguration = 48928,
/**
* Failed to fetch features
*/
FailedToFetchFeatures = 48929,
/**
* Failed to fetch features
*/
FailedToFetchPublicConfiguration = 48930,
/**
* Bad request error
*/
BadRequest = 70002,
/**
* Invalid certificate
*/
BadSsoSettings = 70251
}
/**
* Enumeration of different error severity levels.
* @public
*/
export declare enum ErrorSeverity {
Fatal = "fatal",
Error = "error",
Warning = "warning",
Info = "info"
}
/**
* Exchange a user session token
* @category Authentication
*
* @param options - Your exchange token options
*
* @returns - A promise that resolves with a new token data
*
* @example
* ```ts
* import { exchangeToken } from "@twilio/flex-sdk";
*
* const tokenData = await exchangeToken({
* ssoProfileSid: "SSO_PROFILE_SID",
* code: "AUTH_CODE",
* codeVerifier: "CODE_VERIFIER",
* nonce: "NONCE"
* });
* ```
*
* @public
*/
export declare const exchangeToken: (options: ExchangeTokenParams) => Promise;
/**
* Union type for token exchange parameters supporting both SSO and Console authentication flows.
* @public
*/
export declare type ExchangeTokenParams = SSOExchangeTokenParams | ConsoleExchangeTokenParams;
/**
* Flex Feature Flags enable admins to opt-in to features that are currently in Pilot or Beta in Flex.
* @public
*/
export declare interface FeaturesConfig {
readonly features: Array;
/**
* Indicates if Ytica is active on the account
*/
readonly insightsActive: boolean;
}
/**
* Flex Features
* Features for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* List of features
* @public
*/
export declare interface FeaturesList {
/**
* Feature description
*/
readonly description: string;
/**
* Documentation URL
*/
readonly docUrl: string;
/**
* Is feature enabled
*/
readonly enabled: boolean;
/**
* Feature identifier
*/
readonly id: string;
/**
* Feature name
*/
readonly name: string;
/**
* Feature stage
*/
readonly stage: string;
}
export { FetchTaskQueuesParams }
export { FetchWorkersInfoParams }
export { FetchWorkersParams }
/**
* Custom error class thrown by the Flex SDK with structured error codes and metadata.
* @public
*/
export declare class FlexSdkError extends Error {
constructor(errorCode: ErrorCode, metadata?: FlexSdkErrorMetadata, details?: string, cause?: unknown);
/**
* Error code
* @readonly
*
* @type {ErrorCode}
*/
get code(): ErrorCode;
/**
* Detailed information about what caused the error
* @readonly
*
* @type {string | undefined}
*/
get details(): string | undefined;
/**
* Gets the metadata about the error
* @returns
*
* @readonly
*/
get metadata(): FlexSdkErrorMetadata;
}
/**
* Additional context attached to FlexSdkError instances.
* @public
*/
export declare interface FlexSdkErrorMetadata {
module?: string;
resourceSid?: string;
severity: ErrorSeverity;
source?: string;
translatedErrorCode?: ErrorCode;
unhandled?: boolean;
}
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Flex UI Status Report configuration
* @public
*/
export declare interface FlexUiStatusReport {
enabled: boolean;
}
/**
* Gets account configuration data.
* @param sessionToken - The session token
* @param options - The options object containing the fetch policy
*
* @returns - The account configuration data
*
* @example
* ```ts
* import { getAccountConfig } from "@twilio/flex-sdk";
*
* const accountConfig = await getAccountConfig("token123456789009876543210");
* ```
*
* @public
*/
export declare const getAccountConfig: (sessionToken: string, options?: AccountConfigOptions) => Promise>;
/**
* Get authentication config from the server
* @category Authentication
*
* @param config - Authentication config parameters
*
* @returns
*
* @example
* ```ts
* import { getAuthenticationConfig } from "@twilio/flex-sdk";
*
* const authConfig = await getAuthenticationConfig({
* runtimeDomain: "test-runtime-domain",
* appType: "web"
* });
* ```
*
* @public
*/
export declare const getAuthenticationConfig: (config: AuthenticationConfigParams) => Promise;
/**
* Returns VoiceCall object associated with the provided task.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task.
* @param options - Optional configuration parameters, containing an optional custom voice Device.
*
* @returns A promise that resolves to a `VoiceCall` object, representing the linked call.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToGetCallByTask}
* - {@link ErrorCode.FailedToGetConferenceData}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.TaskNotVoiceTask}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetCallByTask } from "@twilio/flex-sdk/actions/Voice";
*
* async function getCallByTask() {
* const client = await createClient("SDK_TOKEN");
* const getCallByTask = new GetCallByTask("WTXXX");
* const voiceCall = await client.execute(getCallByTask);
* return voiceCall;
* }
* ```
*
* @public
*/
export declare class GetCallByTask implements Action> {
constructor(taskSid: string, options?: GetCallByTaskOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface GetCallByTaskOptions {
voiceDevice?: Device;
}
/**
* Retrieves the conversation for a specified task.
* @category Actions
*
* @param taskSid - The SID of the conversation task.
*
* @returns A promise that resolves to the conversation for the task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToPeekConversation}
* - {@link ErrorCode.NoConversationSidFoundForTask}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.FailedToInitializeConversationsSDK}
* - {@link ErrorCode.FailedToRetrieveConversation}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetConversationByTask } from "@twilio/flex-sdk/actions/Conversation";
*
* async function getConversationByTask() {
* const client = await createClient("SDK_TOKEN");
* const getConversationByTask = new GetConversationByTask(
* "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
* );
* const conversation = await client.execute(getConversationByTask);
* return conversation;
* }
* ```
*
* @public
*/
export declare class GetConversationByTask implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise;
}
/**
* Retrieves a Conversations User.
* @category Actions
*
* @param identity - The identity of the conversations user.
*
* @returns A promise that resolves to the User object.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToRetrieveConversationsUser}
* - {@link ErrorCode.FailedToInitializeConversationsSDK}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetConversationsUser } from "@twilio/flex-sdk/actions/Conversation";
*
* async function getConversationsUser() {
* const client = await createClient("SDK_TOKEN");
* const getConversationsUser = new GetConversationsUser("user_identity");
* const user = await client.execute(getConversationsUser);
* return user;
* }
* ```
*
* @public
*/
export declare class GetConversationsUser implements Action> {
constructor(identity: string);
run(ctx: {}): Promise;
}
/**
* Retrieves conversation transfers for a specified task.
* @category Actions
*
* @param taskSid - The SID of the task the conversation belongs to.
* @param options - Optional configuration parameter for appending notes to the conversation transfers.
*
* @returns A promise that resolves with the currently started conversation transfers.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.ConversationTransferRetrievingForbidden}
* - {@link ErrorCode.FailedToRetrieveConversationTransfer}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.MissingTaskInteractionSid}
* - {@link ErrorCode.MissingChannelSid}
* - {@link ErrorCode.FailedToGetFlexInstanceSid}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetConversationTransfers } from "@twilio/flex-sdk/actions/Conversation";
*
* async function getConversationTransfers() {
* const client = await createClient("SDK_TOKEN");
* const getConversationTransfersAction = new GetConversationTransfers(
* "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
* );
* const transfers = await client.execute(getConversationTransfersAction);
* return transfers;
* }
* ```
*
* @public
*/
export declare class GetConversationTransfers implements Action>> {
constructor(taskSid: string, options?: GetConversationTransfersOptions);
run(ctx: any): Promise;
}
/**
* @public
*/
export declare interface GetConversationTransfersOptions {
withNotes?: boolean;
}
/**
* Retrieves the features config for the provided session token
*
* @param token - Your session token
* @param uiVersion - Flex UI version
*
* @returns - A promise that resolves with the features config
*
* @example
* ```ts
* import { getFeaturesConfig } from "@twilio/flex-sdk";
*
* const featuresConfig = await getFeaturesConfig("token123456789009876543210");
* ```
*
* @public
*/
export declare const getFeaturesConfig: (token: string, uiVersion?: string) => Promise;
/**
* Generate PKCE codes and login URL for the client to sign in with their IdP
* @category Authentication
*
* @param options - Login details config parameters
*
* @returns - SSO login details
*
* @example
* ```typescript
* import { getLoginDetails } from "@twilio/flex-sdk";
*
* const {
* loginUrl,
* codeChallenge,
* nonce,
* state,
* codeVerifier
* } = await getLoginDetails({
* clientId: "XVOxxxxxxxxxxxxx",
* ssoProfileSid: "JQxxxxxxxxxxx",
* redirectUrl: "https://example.com/callback"
* });
*
* console.log("Login URL: ", loginUrl);
* console.log("Code Challenge: ", codeChallenge);
* console.log("Nonce: ", nonce);
* console.log("State: ", state);
* console.log("Code Verifier: ", codeVerifier);
* ```
*
* @public
*/
export declare const getLoginDetails: (options: LoginDetailsParams) => LoginDetailsResponse;
/**
* Retrieves paused conversations.
* @category Actions
*
* @param options - Options for fetching paused conversations, containing page size and page token for pagination.
*
* @returns A promise that resolves to a paginator containing paused conversations.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToRetrievePausedConversations}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetPausedConversations } from "@twilio/flex-sdk/actions/Conversation";
*
* async function getPausedConversations() {
* const client = await createClient("SDK_TOKEN");
* const getPausedConversations = new GetPausedConversations();
* const result = await client.execute(getPausedConversations);
* return result;
* }
* ```
*
* @public
*/
export declare class GetPausedConversations implements Action>> {
constructor(options?: GetPausedConversationsOptions);
private getPausedConversations;
run(ctx: {}): Promise>;
}
/**
* @public
*/
export declare interface GetPausedConversationsOptions {
pageSize?: number;
pageToken?: string;
}
/**
* Retrieves public configuration from the Flex Configuration Service.
* @param option - Either an `AccountSidOption` or `RuntimeDomainOption` object
*
* @returns A `PublicConfig` object with the public configuration
*
* @throws {FlexSdkError} - If the request to the Flex Configuration Service fails.
* @throws {FlexSdkError} - If the response from the Flex Configuration Service is invalid.
*
* @example
* ```ts
* import { getPublicConfig } from "@twilio/flex-sdk";
*
* const publicConfig = await getPublicConfig({ accountSid: "AC123456789009876543210" });
* ```
*
* @public
*/
export declare const getPublicConfig: (option: XOR) => Promise;
/**
* Retrieves all participants attached to a task.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task.
*
* @returns A promise that resolves to an array of `Participant` objects.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.FailedToRetrieveTaskParticipants}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetTaskParticipants } from "@twilio/flex-sdk/actions/Task";
*
* async function getTaskParticipants() {
* const client = await createClient("SDK_TOKEN");
* const getTaskParticipants = new GetTaskParticipants("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const participants = await client.execute(getTaskParticipants);
* return participants;
* }
* ```
*
* @public
*/
export declare class GetTaskParticipants implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare type GetTaskParticipantsResponse = Array;
/**
* The URL endpoint to play when the participant is on hold and the HTTP method for the hold music URL
* @public
*/
export declare interface HoldCallOptions {
holdMusicUrl?: string;
holdMusicMethod?: string;
}
/**
* Puts a voice task participant on hold.
* @category Actions
*
* @param targetParticipantSid - The unique identifier (SID) of the participant to be held. Can be either a worker SID or participant SID.
* @param taskSid - The unique identifier (SID) of the task to hold the participant in.
* @param options - Optional configuration parameters for customizing the participant holding process.
*
* @returns A promise that resolves when the participant is successfully held.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToHoldExternalParticipant}
* - {@link ErrorCode.FailedToHoldWorkerParticipant}
* - {@link ErrorCode.FailedToHoldVoiceParticipant}
* - {@link ErrorCode.WorkerCannotHoldReservation}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.ParticipantNotFound}
* - {@link ErrorCode.FailedToRetrieveTaskParticipants}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { HoldVoiceParticipant } from "@twilio/flex-sdk/actions/Voice";
*
* async function holdVoiceParticipant() {
* const client = await createClient("SDK_TOKEN");
* const holdVoiceParticipantAction = new HoldVoiceParticipant(
* "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
* );
* await client.execute(holdVoiceParticipantAction);
* }
* ```
*
* @public
*/
export declare class HoldVoiceParticipant implements Action> {
constructor(targetParticipantSid: string, taskSid: string, options?: HoldVoiceParticipantOptions);
run(ctx: {}): Promise;
}
/**
* Configuration options for holding a participant in a task.
* @public
*/
export declare interface HoldVoiceParticipantOptions {
/**
* The URL of the hold music to play to the participant.
*/
holdMusicUrl?: string;
/**
* The HTTP method to use when fetching the hold music.
*/
holdMusicMethod?: string;
}
export { IncomingTransfer }
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Integrations config
* @public
*/
export declare interface IntegrationsConfig {
name: string;
type: string;
active: boolean;
config: object;
/**
* Url of logo
*/
logo?: string;
author?: string;
}
/**
* Kicks a participant from a task.
* @category Actions
*
* @param targetParticipantSid - The unique identifier (SID) of the participant to be kicked, can be either worker SID or participant SID.
* @param taskSid - The unique identifier (SID) of the task to kick the participant from.
*
* @returns A promise that resolves when the participant is successfully kicked.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedSelfKick}
* - {@link ErrorCode.FailedToKickVoiceParticipant}
* - {@link ErrorCode.InvalidParticipantSid}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.ParticipantNotFound}
* - {@link ErrorCode.FailedToRetrieveTaskParticipants}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { KickVoiceParticipant } from "@twilio/flex-sdk/actions/Voice";
*
* async function kickVoiceParticipant() {
* const client = await createClient("SDK_TOKEN");
* const kickVoiceParticipant = new KickVoiceParticipant("UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* await client.execute(kickVoiceParticipant);
* }
* ```
*
* @public
*/
export declare class KickVoiceParticipant implements Action> {
constructor(targetParticipantSid: string, taskSid: string);
run(ctx: {}): Promise;
}
/**
* Leaves a conversation.
* @category Actions
*
* @param taskSid - The SID of the task the conversation is linked to.
*
* @returns A promise that resolves when the conversation is successfully left.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToLeaveConversation}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.MissingTaskInteractionSid}
* - {@link ErrorCode.MissingChannelSid}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { LeaveConversation } from "@twilio/flex-sdk/actions/Conversation";
*
* async function leaveConversation() {
* const client = await createClient("SDK_TOKEN");
* const leaveConversationAction = new LeaveConversation("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* await client.execute(leaveConversationAction);
* }
* ```
*
* @public
*/
export declare class LeaveConversation implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise;
}
/**
* Legacy token information.
* @public
*/
export declare interface LegacyTokenData {
valid: boolean;
roles: Array;
dateExpired: Date;
identity: string;
flexUserSid: string;
}
/**
* Logging severity levels for controlling log output verbosity.
* @public
*/
export declare type LoggerLevel = LogLevelDesc;
/**
* Numeric representation of logger levels.
* @public
*/
export declare type LoggerLevelNumbers = LogLevelNumbers;
/**
* Options for configuring logging.
* @public
*/
export declare interface LoggerOptions {
level: LoggerLevel;
}
/**
* Union type for login details parameters supporting both SSO and Console authentication flows.
* @public
*/
export declare type LoginDetailsParams = SSOLoginDetailsParams | ConsoleLoginDetailsParams;
/**
* Response containing OAuth2 login URL and PKCE parameters for secure authentication flow.
* @public
*/
export declare interface LoginDetailsResponse {
/**
* The login URL to redirect the user to for authentication.
*/
loginUrl: string;
/**
* The nonce value used for exchanging the authorization code for an access token.
*/
nonce: string;
/**
* The code challenge value used for exchanging the authorization code for an access token.
*/
codeChallenge: string;
/**
* The state value used for exchanging the authorization code for an access token.
*/
state: string;
/**
* The code verifier value used for exchanging the authorization code for an access token.
*/
codeVerifier: string;
}
export { Media }
export { MediaCategory }
/**
* Media channel type
* @public
*/
export declare enum MediaChannelType {
Email = "email",
Sms = "sms",
WhatsApp = "whatsapp",
Web = "web",
Voice = "voice",
Messenger = "messenger",
Chat = "chat",
Gbm = "gbm",
Video = "video"
}
/**
* Media properties
* @public
*/
export declare type MediaProperties = {
[key: string]: any;
};
export { Message }
export { MessageBuilder }
/**
* Direction for retrieving messages from a conversation timeline.
* @public
*/
export declare enum MessagesDirection {
Backwards = "backwards",
Forward = "forward"
}
export { MessageType }
export { MessageUpdateReason }
/**
* Monitors a provided ongoing call of another agent.
* @category Actions
*
* @param taskSid - The taskSid of the task to monitor the call for.
* @param reservationSid - The reservationSid of the task to monitor the call for.
* @param options - Optional configuration parameters for customizing the monitor call process.
*
* @returns A promise that resolves to a `VoiceCall` object, representing the call.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.SupervisorAlreadyMonitoringCall}
* - {@link ErrorCode.FailedToMonitorCall}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { MonitorCall } from "@twilio/flex-sdk/actions/Voice";
*
* async function example() {
* const client = await createClient("SDK_TOKEN");
* const monitorCall = new MonitorCall("WTXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXX");
* const call = await client.execute(monitorCall);
* }
* ```
*
* @public
*/
export declare class MonitorCall implements Action> {
constructor(taskSid: string, reservationSid: string, options?: MonitorCallOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface MonitorCallOptions {
extraParams?: Record;
voiceDevice?: Device;
}
export { NotificationLevel }
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Outbound flows
* @public
*/
export declare interface OutboundFlows {
/**
* Enable flag
*/
enabled: boolean;
/**
* Phone number
*/
caller_id: string;
/**
* Queue sid
*/
queue_sid: string;
/**
* Country code
*/
location: string;
/**
* Workflow sid
*/
workflow_sid: string;
}
export { OutgoingTransfer }
/**
* @public
*
* @typeParam T - The item type.
*/
export declare interface Paginator {
/**
* Indicates the existence of the next page.
*/
hasNextPage: boolean;
/**
* Indicates the existence of the previous page.
*/
hasPrevPage: boolean;
/**
* Array of elements of type T on the current page.
*/
items: T[];
/**
* Request next page.
* Does not modify the existing object.
*/
nextPage(): Promise>;
/**
* Request previous page.
* Does not modify the existing object.
*/
prevPage(): Promise>;
}
/**
* Call properties for add voice participant
* @public
*/
export declare type ParticipantCallProperties = {
timeout: number;
statusCallBack: ParticipantCallStatusProperties;
record: ParticipantCallRecordProperties;
sip: ParticipantSipProperties;
};
/**
* Call record properties for add voice participant
* @public
*/
export declare type ParticipantCallRecordProperties = {
url: string;
method: 'GET' | 'POST';
channels: string;
};
/**
* Enumeration of values representing the state of a participant's call.
* @public
*/
export declare enum ParticipantCallStatus {
Init = "init",
Queued = "queued",
Connecting = "connecting",
Connected = "connected",
Complete = "complete",
Failed = "failed",
Busy = "busy",
NoAnswer = "no-answer",
Ringing = "ringing",
InProgress = "in-progress",
Completed = "completed",
Canceled = "canceled"
}
/**
* Call status properties for add voice participant
* @public
*/
export declare type ParticipantCallStatusProperties = {
url: string;
method: 'GET' | 'POST';
events: string;
};
export { ParticipantEmailLevel }
/**
* Data of a participant received from events
* @public
*/
export declare type ParticipantEventData = {
/**
* The sid of the participant (UTxxx)
*/
participant_sid: string;
/**
* The type of the participant
*/
type: ParticipantType;
/**
* The type of the channel
*/
channel_type: MediaChannelType;
/**
* The sid of the channel (UOxxx)
*/
channel_sid: string;
/**
* The sid of the interaction (KDxxx)
*/
interaction_sid: string;
/**
* The routing properties of the participant
*/
routing_properties: RoutingData | null;
/**
* Media properties of the participant
*/
media_properties: MediaProperties | null;
};
/**
* Participant level in an email
* @public
*/
export declare enum ParticipantLevel {
To = "to",
CC = "cc"
}
/**
* Response for the participant endpoint request
* @public
*/
export declare type ParticipantResponse = {
/**
* The identifier of the participant who is added to the channel
*/
sid: string;
/**
* The channel sid of the channel where the participant is added
*/
channel_sid: string;
/**
* The identifier of the interaction where the participant is added
*/
interaction_sid: string;
/**
* Optional media properties of the participant
*/
media_properties: MediaProperties | null;
};
/**
* Sip properties for add voice participant
* @public
*/
export declare type ParticipantSipProperties = {
username: string;
password: string;
};
/**
* Type of the participant, 'agent', 'customer', 'supervisor', 'external' or 'unknown'
* @public
*/
export declare enum ParticipantType {
Agent = "agent",
Customer = "customer",
Supervisor = "supervisor",
External = "external",
Unknown = "unknown"
}
/**
* Pauses a conversation.
* @category Actions
*
* @param taskSid - The SID of the task the conversation is linked to.
*
* @returns A promise that resolves when the conversation is successfully paused.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToPauseConversation}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.MissingTaskInteractionSid}
* - {@link ErrorCode.MissingChannelSid}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { PauseConversation } from "@twilio/flex-sdk/actions/Conversation";
*
* async function pauseConversation() {
* const client = await createClient("SDK_TOKEN");
* const pauseConversationAction = new PauseConversation("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* await client.execute(pauseConversationAction);
* }
* ```
*
* @public
*/
export declare class PauseConversation implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise;
}
/**
* PausedChannelsResponse Response
* @public
*/
export declare type PausedChannelsResponse = {
content: {
sid: string;
account_sid: string;
interaction_sid: string;
workspace_sid: string;
workflow_sid: string;
wds_queue_sid: string;
status: string;
status_timeout: string;
task_channel_sid: string;
attributes: string;
date_created: string;
date_updated: string;
}[];
meta: {
list_key: string;
previous_token: string;
next_token: string;
direct_token: boolean;
page_size: number;
};
};
/**
* @public
*/
export declare interface PausedConversation {
sid: string;
accountSid: string;
interactionSid: string;
workspaceSid: string;
workflowSid: string;
wdsQueueSid: string;
status: string;
statusTimeout: string;
taskChannelSid: string;
attributes: Record;
dateCreated: string;
dateUpdated: string;
}
/**
* Public configuration object
* @public
*/
export declare interface PublicConfig {
/**
* Runtime domain
*/
runtimeDomain: string;
publicAttributes: PublicConfigAttributes | null;
/**
* Account SID (may be encrypted)
*/
accountSid: string;
}
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Public configuration attributes
* @public
*/
export declare interface PublicConfigAttributes {
[key: string]: object | unknown;
/**
* Whether the SSO flow needs to be launched in a popup window
*/
loginPopup?: boolean;
}
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Queue channel configuration object
* @public
*/
export declare interface QueueChannelConfiguration {
/**
* Queue sid
*/
queue_sid: string;
channel_sid: string;
service_level_threshold: number;
short_abandoned_threshold: number;
}
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Queue configuration object
* @public
*/
export declare interface QueueConfiguration {
queue_sid: string;
reset_timezone: string;
reset_time: string;
}
/**
* Queue stats configuration object
* @public
*/
export declare interface QueueStatsConfiguration {
default: DefaultQueueStatsConfiguration;
/**
* List of Queue Configurations for an account
*/
queue_configurations: Array;
/**
* List of Queue Channel Configurations for an account
*/
queue_channel_configurations: Array;
}
/**
* Enumeration of reasons why a participant left a voice conference.
* @public
*/
export declare enum ReasonParticipantLeft {
ConferenceEndedViaAPI = "conference_ended_via_api",
ModeratorEndedConference = "moderator_ended_conference",
ParticipantUpdatedViaApi = "participant_updated_via_api",
ParticipantHungUp = "participant_hung_up",
ParticipantAddFailed = "participant_add_failed"
}
export { RedirectOptions }
/**
* Refresh a user session token
* @category Authentication
*
* @param options - Your refresh token options
*
* @returns - A promise that resolves with a new token data
*
* @example
* ```ts
* import { refreshToken } from "@twilio/flex-sdk";
*
* const tokenData = await refreshToken({ refreshToken: "TOKEN", ssoProfileSid: "SSO_PROFILE_SID" });
* ```
*
* @public
*/
export declare const refreshToken: (options: RefreshTokenParams) => Promise;
/**
* Parameters for refreshing authentication tokens to extend session.
* @public
*/
export declare interface RefreshTokenParams {
/**
* App type. This is needed if it was provided in the initial authentication request.
*/
appType?: AppType;
/**
* SSO profile for which the auth code was obtained. (Required for SSO login)
*/
ssoProfileSid?: string;
/**
* Account for which the auth code was obtained.
*/
accountSid?: string;
/**
* Flex instance for which the auth code was obtained.
*/
instanceSid?: string;
/**
* Flag indicating console login (Must be true for console login)
*/
isConsoleLogin?: boolean;
/**
* Used to extend session without re-authentication.
*/
refreshToken?: string;
}
export { RejectOptions }
/**
* Rejects a task for the current worker.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to be rejected.
* @param options - Optional parameters for rejecting the task, such as the activity SID to set after rejection.
*
* @returns A promise that resolves to a `Reservation` and a `Task` object representing the rejected task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToRejectReservation}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { RejectTask } from "@twilio/flex-sdk/actions/Task";
*
* async function rejectTask() {
* const client = await createClient("SDK_TOKEN");
* const rejectTask = new RejectTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const { task, reservation } = await client.execute(rejectTask);
* return { task, reservation };
* }
* ```
*
* @public
*/
export declare class RejectTask implements Action> {
constructor(taskSid: string, options?: RejectTaskOptions);
run(ctx: {}): Promise<{
task: Task;
reservation: Reservation;
}>;
}
/**
* @public
*/
export declare interface RejectTaskOptions extends RejectOptions {
}
/**
* Removes a participant from an email task.
* @category Actions
*
* @param taskSid - The SID of the email task.
* @param participantSid - The SID of the participant to remove.
*
* @returns A promise that resolves to the removed participant when successfully removed.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.TaskNotEmailTask}
* - {@link ErrorCode.FailedToRemoveEmailParticipant}
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { RemoveEmailParticipant } from "@twilio/flex-sdk/actions/Conversation";
*
* async function removeEmailParticipant() {
* const client = await createClient("SDK_TOKEN");
* const removeEmailParticipant = new RemoveEmailParticipant(
* "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
* );
* const removedParticipant = await client.execute(removeEmailParticipant);
* return removedParticipant;
* }
* ```
*
* @public
*/
export declare class RemoveEmailParticipant implements Action> {
constructor(taskSid: string, participantSid: string);
run(ctx: {}): Promise;
}
export { Reservation }
export { ReservationEvents }
export { ReservationParticipantOptions }
/**
* Resumes a conversation.
* @category Actions
*
* @param pausedConversation - The paused conversation object obtained from `GetPausedConversations` action, containing `interactionSid` and `sid`.
*
* @returns A promise that resolves to an object containing the task and the conversation.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToResumeConversation}
* - {@link ErrorCode.FailedToGetReservationAfterConversationResuming}
* - {@link ErrorCode.MissingRequiredParameter}
* - {@link ErrorCode.FailedToInitializeConversationsSDK}
* - {@link ErrorCode.FailedToAcceptReservation}
* - {@link ErrorCode.FailedToRetrieveConversation}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { ResumeConversation, GetPausedConversations } from "@twilio/flex-sdk/actions/Conversation";
*
* async function resumeConversation() {
* const client = await createClient("SDK_TOKEN");
*
* // Retrieves paused conversations
* const getPausedConversations = new GetPausedConversations();
* const pausedConversations = await client.execute(getPausedConversations);
*
* // Select the paused conversation
* const pausedConversation = pausedConversations.items[0];
*
* // Resume the conversation
* const resumeConversation = new ResumeConversation(pausedConversation);
* const { task, conversation } = await client.execute(resumeConversation);
* return { task, conversation };
* }
* ```
*
* @public
*/
export declare class ResumeConversation implements Action> {
constructor(pausedConversation: Pick);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface ResumeConversationResponse {
task: Task;
conversation: Conversation;
}
/**
* Data used for routing
* @public
*/
export declare type RoutingData = {
/**
* Sid of a task this routing data corresponds to (WTxxx)
*/
task_sid: string;
/**
* Sid of a worker this routing data corresponds to (WKxxx)
*/
worker_sid?: string;
/**
* Sid of a reservation this routing data corresponds to (WRxxx)
*/
reservation_sid?: string;
};
/**
* Routing properties of one participant
* @public
*/
export declare class RoutingProperties {
/**
* Sid of a task these routing properties correspond to (WTxxx)
*/
readonly taskSid: string;
/**
* Sid of a worker these routing properties correspond to (WKxxx)
*/
readonly workerSid?: string;
/**
* Sid of a reservation these routing properties correspond to (WRxxx)
*/
readonly reservationSid?: string;
constructor(routingData: RoutingData);
}
/**
* Runtime domain option
* @public
*/
export declare interface RuntimeDomainOption {
/**
* Runtime domain
*/
runtimeDomain: string;
}
/**
* Options for sending email messages in a conversation with HTML and plain text content.
* @public
*/
export declare interface SendEmailMessageOptions {
messageAttributes?: any;
subject?: string;
attachedFiles?: File[];
htmlBody: string;
plainTextBody?: string;
}
/**
* Options for sending media messages with file attachments in a conversation.
* @public
*/
export declare interface SendMediaMessageOptions {
attachedFiles: File[];
messageAttributes?: any;
}
/**
* Options for sending text messages in a conversation.
* @public
*/
export declare interface SendTextMessageOptions {
body: string;
messageAttributes?: any;
attachedFiles?: File[];
}
/**
* Union of the {@link DefaultSessionOptions}, {@link ConsoleSessionOptions}, and {@link SSOSessionOptions} interfaces.
* @public
*/
export declare type SessionOptions = DefaultSessionOptions | ConsoleSessionOptions | SSOSessionOptions;
/**
* @param accountSid - Flex Account SID
* @param sessionToken - The session token
* @param config - The partial AccountConfigData to set
*
* @returns - The updated account configuration
*
* @public
*/
export declare const setAccountConfig: (accountSid: string, sessionToken: string, config: Partial) => Promise>;
/**
* Sets attributes for the worker.
* @category Actions
*
* @param attributes - An object containing attributes to set for the worker.
* @param options - Optional configuration parameters for customizing the attribute setting process.
*
* @returns A promise that resolves when the attributes are successfully set.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToSetCurrentWorkerAttributes}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { SetAttributes } from "@twilio/flex-sdk/actions/Worker";
*
* async function setWorkerAttributes() {
* const client = await createClient("SDK_TOKEN");
* const setAttributesAction = new SetAttributes({ key: "value" });
* await client.execute(setAttributesAction);
* }
* ```
*
* @public
*/
export declare class SetAttributes implements Action> {
constructor(attributes: Record, options?: SetAttributesOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface SetAttributesOptions {
mergeExisting?: boolean;
}
/**
* Sets the current activity for the worker.
* @category Actions
*
* @param activitySid - The unique identifier (SID) of the activity to be set as the current activity.
* @param options - Optional configuration parameters for customizing the activity setting process.
*
* @returns A promise that resolves when the current activity is successfully set.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToSetCurrentWorkerActivityDueToPendingReservations}
* - {@link ErrorCode.FailedToSetCurrentWorkerActivity}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient, SetCurrentActivity } from "@twilio/flex-sdk";
*
* async function setCurrentActivity() {
* const client = await createClient("SDK_TOKEN");
* const worker = await client.getWorker();
*
* // Activities are accessible via Worker.activities property (Map of activitySID to Activity)
* const activities = Array.from(worker.activities.values());
* const targetActivity = activities.find(activity => activity.name === "Available") || activities[0];
*
* console.log(`Setting worker activity to "${targetActivity.name}" (${targetActivity.sid})`);
*
* const setCurrentActivityAction = new SetCurrentActivity(targetActivity.sid);
* await client.execute(setCurrentActivityAction);
* }
* ```
*
* @public
*/
export declare class SetCurrentActivity implements Action> {
constructor(activitySid: string, options?: SetCurrentActivityOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface SetCurrentActivityOptions {
activityUpdateOptions?: ActivityOptions;
}
/**
* Sets attributes for a task.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to set attributes for.
* @param attributes - An object containing attributes to set for the task.
* @param options - Optional configuration parameters for customizing the attribute setting process.
*
* @returns A promise that resolves to a Task object, representing the updated task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToSetTaskAttributes}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { SetTaskAttributes } from "@twilio/flex-sdk/actions/Task";
*
* async function setTaskAttributes() {
* const client = await createClient("SDK_TOKEN");
* const setTaskAttributesAction = new SetTaskAttributes(
* "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* { key: "value" }
* );
* const updatedTask = await client.execute(setTaskAttributesAction);
* return updatedTask;
* }
* ```
*
* @public
*/
export declare class SetTaskAttributes implements Action> {
constructor(taskSid: string, attributes: Record, options?: SetTaskAttributesOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface SetTaskAttributesOptions {
mergeExisting?: boolean;
}
/**
* Sets an activity for a worker.
* @category Actions
*
* @param targetWorkerSid - The unique identifier (SID) of the worker to set the activity for.
* @param activitySid - The unique identifier (SID) of the activity to be set for the worker.
* @param options - Optional configuration parameters for customizing the activity setting process.
*
* @returns A promise that resolves when the activity is successfully set for the worker.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToSetWorkerActivityBySupervisor}
* - {@link ErrorCode.ActivityChangeRejectedPendingReservations}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient, SetWorkerActivity } from "@twilio/flex-sdk";
*
* async function setWorkerActivity() {
* const client = await createClient("SDK_TOKEN");
* const workspace = await client.getWorkspace();
* const worker = await client.getWorker();
*
* // Get workers from the workspace
* const workerInfos = Array.from((await workspace.fetchWorkersInfo()).values());
* const targetWorkerInfo = workerInfos.find(workerInfo => workerInfo.name === "John Doe") || workerInfos[0];
*
* // Activities are accessible via Worker.activities property (Map of activitySID to Activity)
* const activities = Array.from(worker.activities.values());
* const targetActivity = activities.find(activity => activity.name === "Break") || activities[0];
*
* console.log(`Setting worker "${targetWorkerInfo.name}" activity to "${targetActivity.name}" (${targetActivity.sid})`);
*
* const setWorkerActivityAction = new SetWorkerActivity(targetWorkerInfo.sid, targetActivity.sid);
* await client.execute(setWorkerActivityAction);
* }
* ```
*
* @public
*/
export declare class SetWorkerActivity implements Action> {
constructor(targetWorkerSid: string, activitySid: string, options?: SetWorkerActivityOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface SetWorkerActivityOptions {
activityUpdateOptions?: ActivityOptions;
}
/**
* Sets attributes for a worker.
* @category Actions
*
* @param targetWorkerSid - The unique identifier (SID) of the worker to set attributes for.
* @param attributes - An object containing the attributes to set for the worker.
* @param options - Optional configuration parameters for customizing the attribute setting process.
*
* @returns A promise that resolves when the attributes are successfully set for the worker.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToSetWorkerAttributesBySupervisor}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { SetWorkerAttributes } from "@twilio/flex-sdk/actions/Supervisor";
*
* async function setWorkerAttributes() {
* const client = await createClient("SDK_TOKEN");
* const setWorkerAttributesAction = new SetWorkerAttributes(
* "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* { key: "value" }
* );
* await client.execute(setWorkerAttributesAction);
* }
* ```
*
* @public
*/
export declare class SetWorkerAttributes implements Action> {
constructor(targetWorkerSid: string, attributes: Record, options?: SetWorkerAttributesOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface SetWorkerAttributesOptions {
mergeExisting?: boolean;
}
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Taskrouter skill definition
* @public
*/
export declare interface SkillDefinition {
/**
* Skill name
*/
name: string;
/**
* Skill type, if true value can be given between min and max
*/
multivalue: boolean;
/**
* minimum value
*/
minimum?: number;
/**
* maximum value
*/
maximum?: number;
}
/**
* Parameters for exchanging an authorization code for a token in the SSO authentication flow.
* @public
*/
export declare interface SSOExchangeTokenParams {
/**
* App type. This is needed if it was provided in the initial authentication request.
*/
appType?: AppType;
/**
* SSO profile for which the auth code was obtained. (Required for SSO login)
*/
ssoProfileSid: string;
/**
* Auth code, required with authorization_code grant
*/
code: string;
/**
* Code verifier (PKCE), required with authorization_code grant.
*/
codeVerifier: string;
/**
* Nonce, required with authorization_code grant.
*/
nonce: string;
/**
* Flag indicating console login (Must be true for console login)
*/
isConsoleLogin?: false;
}
/**
* Parameters for generating SSO login details and authentication URLs.
* @public
*/
export declare interface SSOLoginDetailsParams {
/**
* The connection id for the specific account (obtained via the getAccountConfig).
*/
clientId: string;
/**
* SSO profile for which the auth code was obtained. (Required for SSO login)
*/
ssoProfileSid: string;
/**
* App type. This is needed if it was provided in the initial authentication request.
*/
appType?: AppType;
/**
* Flag indicating console login (Must be true for console login)
*/
isConsoleLogin?: false;
/**
* Redirect url where to return back after the identity provider user authentication.
*/
redirectUrl?: string;
}
/**
* Options for Single Sign-On (SSO) authentication.
* @public
*/
export declare interface SSOSessionOptions {
readonly autoUpdateToken: true;
readonly isConsoleLogin: false;
readonly refreshToken: string;
readonly ssoProfileSid: string;
readonly appType?: AppType;
}
/**
* Token information for SSO authentication.
* @public
*/
export declare interface SSOTokenData {
valid: boolean;
roles: Array;
dateExpired: Date;
expiration: Date;
identity: string;
flexUserSid: string;
nameId: string;
realmUserId: string;
workerSid: string;
flexInstanceSid: string;
accountSid: string;
permissions?: Array | null;
}
/**
* Transfers a conversation to an another worker, a queue or a workflow.
* @category Actions
*
* @param taskSid - The SID of the task the conversation belongs to.
* @param to - Worker SID or Workflow SID or Queue SID to which the conversation should be transferred.
* @param options - Optional configuration parameters for customizing the conversation transfer.
*
* @returns A promise that resolves when the conversation is successfully transferred.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToStartConversationTransfer}
* - {@link ErrorCode.ConversationTransferForbidden}
* - {@link ErrorCode.WorkerParticipantNotFoundForTask}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.MissingTaskInteractionSid}
* - {@link ErrorCode.MissingChannelSid}
* - {@link ErrorCode.FailedToGetFlexInstanceSid}
* - {@link ErrorCode.FailedToRetrieveTaskParticipants}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { StartConversationTransfer } from "@twilio/flex-sdk/actions/Conversation";
*
* async function startConversationTransfer() {
* const client = await createClient("SDK_TOKEN");
* const startConversationTransferAction = new StartConversationTransfer(
* "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
* "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
* );
* await client.execute(startConversationTransferAction);
* }
* ```
*
* @public
*/
export declare class StartConversationTransfer implements Action> {
constructor(taskSid: string, to: string);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface StartConversationTransferOptions {
}
/**
* Initiates an outbound voice call to a specified phone number.
*
* @category Actions
*
* @param toNumber - The phone number to call.
* @param options - Optional configuration parameters for customizing the outbound call process.
*
* @returns A promise that resolves to a `VoiceCall` object, representing the outbound call.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FromNumberRequired}
* - {@link ErrorCode.TaskQueueSidRequired}
* - {@link ErrorCode.WorkflowSidRequired}
* - {@link ErrorCode.WorkerOfflineOutboundCallCancelled}
* - {@link ErrorCode.OutboundCallingDisabled}
* - {@link ErrorCode.InboundCallPendingOutboundCancelled}
* - {@link ErrorCode.InboundCallAcceptedOutboundCancelled}
* - {@link ErrorCode.NoAudioInputDeviceAvailable}
* - {@link ErrorCode.IncomingCallTimeout}
* - {@link ErrorCode.FailedToCreateTask}
* - {@link ErrorCode.FailedToCreateVoiceTaskReservation}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.MissingRequiredParameter}
* - {@link ErrorCode.TaskrouterOfflineActivitySidNotConfigured}
* - {@link ErrorCode.FailedToCreateConference}
*
* @example
* ```ts
* import { createClient, Reservation } from "@twilio/flex-sdk";
* import { StartOutboundCall, StartOutboundCallOptions } from "@twilio/flex-sdk/actions/Voice";
*
* async function startOutboundCall() {
* const client = await createClient("SDK_TOKEN");
* const reservationCanceledHandler = (reservation: Reservation) => {
* console.log(
* `Reservation canceled with reason https://www.twilio.com/docs/api/errors/${reservation.canceledReasonCode}`
* );
* reservation.off("canceled", reservationCanceledHandler);
* };
* const startOutboundCallOptions: StartOutboundCallOptions = {
* reservationEventListeners: {
* canceled: reservationCanceledHandler
* }
* };
* const startOutboundCallAction = new StartOutboundCall("+15555555555", startOutboundCallOptions);
* const call = await client.execute(startOutboundCallAction);
* }
* ```
*
* @public
*/
export declare class StartOutboundCall implements Action> {
constructor(toNumber: string, options?: StartOutboundCallOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface StartOutboundCallOptions {
fromNumber?: string;
workflowSid?: string;
taskQueueSid?: string;
attributesForTaskCreation?: object;
conferenceOptions?: Partial;
voiceDevice?: Device;
reservationEventListeners?: Partial;
}
/**
* Starts an outbound email task.
* @category Actions
*
* @param to - The receiver email address.
* @param options - Optional configuration parameters for customizing the outbound email process.
*
* @returns A promise that resolves to a `StartOutboundEmailTaskResponse` object, containing the Task and the Conversation objects.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.WorkerOfflineEmailTaskCancelled}
* - {@link ErrorCode.FailedToCreateOutboundEmailTask}
* - {@link ErrorCode.FailedToRetrieveOutboundEmailSettings}
* - {@link ErrorCode.OutboundEmailWorkflowSidUndefined}
* - {@link ErrorCode.OutboundEmailQueueSidUndefined}
* - {@link ErrorCode.OutboundEmailFromParameterUndefined}
* - {@link ErrorCode.FailedToCreateOutboundEmailTaskReservation}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.MissingRequiredParameter}
* - {@link ErrorCode.FailedToInitializeConversationsSDK}
* - {@link ErrorCode.FailedToAcceptReservation}
* - {@link ErrorCode.FailedToRetrieveConversation}
* - {@link ErrorCode.TaskrouterOfflineActivitySidNotConfigured}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { StartOutboundEmailTask } from "@twilio/flex-sdk/actions/Conversation";
*
* async function startOutboundEmailTask() {
* const client = await createClient("SDK_TOKEN");
* const startOutboundEmailTask = new StartOutboundEmailTask("name@email.com");
* const { task, conversation } = await client.execute(startOutboundEmailTask);
* return { task, conversation };
* }
* ```
*
* @public
*/
export declare class StartOutboundEmailTask implements Action> {
constructor(to: string, options?: StartOutboundEmailTaskOptions);
run(ctx: {}): Promise;
}
/**
* @public
*/
export declare interface StartOutboundEmailTaskOptions {
from?: string;
fromName?: string;
taskQueueSid?: string;
workflowSid?: string;
attributesForTaskCreation?: object;
}
/**
* @public
*/
export declare interface StartOutboundEmailTaskResponse {
task: Task;
conversation: Conversation;
}
/**
* Transfers a voice task to a target worker or a queue.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to be transferred.
* @param to - The unique identifier (SID) of the worker or the queue to transfer the task to.
* @param options - Optional configuration parameters for customizing the task transfer process.
*
* @returns A promise that resolves to a `Task` object, representing the transferred task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.VoiceTaskTransferAlreadyInitiated}
* - {@link ErrorCode.WorkerCannotTransferVoiceTaskFromDifferentWorker}
* - {@link ErrorCode.FailedToStartVoiceTaskTransfer}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.TaskNotVoiceTask}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { StartVoiceTaskTransfer } from "@twilio/flex-sdk/actions/Voice";
*
* async function transferVoiceTask() {
* const client = await createClient("SDK_TOKEN");
* const startVoiceTaskTransfer = new StartVoiceTaskTransfer("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const transferredTask = await client.execute(startVoiceTaskTransfer);
* return transferredTask;
* }
* ```
*
* @public
*/
export declare class StartVoiceTaskTransfer implements Action> {
constructor(taskSid: string, to: string, options?: TransferTaskOptions);
run(ctx: {}): Promise;
}
/**
* Enumeration of events that trigger participant status changes during voice calls.
* @public
*/
export declare enum StatusCallbackEvent {
ConferenceStart = "conference-start",
ConferenceEnd = "conference-end",
ParticipantJoin = "participant-join",
ParticipantLeave = "participant-leave",
ParticipantMute = "participant-mute",
ParticipantUnmute = "participant-unmute",
ParticipantModify = "participant-modify",
ParticipantSpeechStart = "participant-speech-start",
ParticipantSpeechStop = "participant-speech-stop",
ParticipantHold = "participant-hold",
ParticipantUnhold = "participant-unhold"
}
/**
* A wrapper for the TaskRouter Supervisor class.
* @public
*/
export declare class Supervisor extends Supervisor_2 {
constructor(token: string, options?: WorkerOptions_2);
}
export { Task }
export { TaskEvents }
export { TaskHoldOptions }
export { TaskOptions }
/**
* Union of the {@link VoiceTaskParticipant} and {@link ConversationTaskParticipant} types.
* @public
*/
export declare type TaskParticipant = VoiceTaskParticipant | ConversationTaskParticipant;
/**
* @public
*/
export declare interface TaskParticipantEvent {
participantAdded: (task: Task, participant: TaskParticipant) => void;
participantRemoved: (task: Task, participant: TaskParticipant) => void;
participantModified: (task: Task, participant: TaskParticipant) => void;
participantAddFailed: (task: Task, participant: TaskParticipant) => void;
participantRemoveFailed: (task: Task, participant: TaskParticipant) => void;
participantModifyFailed: (task: Task, participant: TaskParticipant) => void;
}
export { TaskParticipantOptions }
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Task queues used for Transfers
* @public
*/
export declare interface TaskQueue {
/**
* TaskQueue Sid
*/
sid: string;
/**
* TaskQueue available as target
*/
targettable: boolean;
}
/**
* @public
*/
export declare interface TaskReservation {
task: Task;
reservation: Reservation;
}
/**
* Options for configuring TaskRouter Worker and Workspace for Flex SDK initialization.
* @public
*/
export declare interface TaskRouterOptions {
/**
* Worker-related options
*/
readonly workerOptions?: WorkerOptions_2;
/**
* Workspace-related options
*/
readonly workspaceOptions?: WorkspaceOptions;
}
export { TaskRouterTaskQueue }
export { TaskTransferOptions }
/**
* Options for configuring telemetry sent by Flex SDK.
* @public
*/
export declare interface TelemetryOptions {
/**
* Flag to disable the telemetry feature.
* @defaultValue false
*/
disabled: boolean;
}
/**
* Union type representing token data from either legacy or SSO authentication systems.
* @public
*/
export declare type TokenData = LegacyTokenData | SSOTokenData;
/**
* Result returned when refreshing authentication tokens, containing the new token and expiration date.
* @public
*/
export declare interface TokenRefreshResult {
token: string;
dateExpired: Date;
}
/**
* SSO Setup Service
* Service to set up SSO details for Flex customer\'s IDP
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Contains the access and refresh tokens after successful authentication.
* @public
*/
declare interface TokenResponseBody {
/**
* Flex JWE token.
*/
accessToken: string;
/**
* Used to extend user session without needing re-authentication.
*/
refreshToken: string;
tokenInfo?: object;
}
export { TokenResponseBody as ExchangeTokenResponse }
export { TokenResponseBody as RefreshTokenResponse }
/**
* The Transfer response object
* @public
*/
export declare type Transfer = {
sid: string;
accountSid: string;
instanceSid: string;
interactionSid: string;
channelSid: string;
type: string;
from: string;
to: string;
status: string;
executionSid: string;
noteSid: string;
summarySid: string;
reason: string;
dateCreated: string;
dateUpdated: string;
};
export { TransferOptions }
export { Transfers }
/**
* @public
*/
export declare interface TransferTaskOptions extends TransferOptions {
}
export { TwilioConversation }
/**
* Connection states for Twilio Conversations websocket connections.
* @public
*/
export declare type TwilsockConnectionState = "connected" | "disconnected" | "connecting" | "denied" | "tokenExpired" | "connectionError";
export { TypePolicies }
/**
* Removes a participant from hold status in a task.
* @category Actions
*
* @param targetParticipantSid - The unique identifier (SID) of the participant to be unheld. Can be either a worker SID or participant SID.
* @param taskSid - The unique identifier (SID) of the task to unhold the participant in.
*
* @returns A promise that resolves when the participant is successfully unheld.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToUnholdExternalParticipant}
* - {@link ErrorCode.FailedToUnholdWorkerParticipant}
* - {@link ErrorCode.FailedToUnholdVoiceParticipant}
* - {@link ErrorCode.WorkerCannotUnholdReservation}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
* - {@link ErrorCode.ParticipantNotFound}
* - {@link ErrorCode.FailedToRetrieveTaskParticipants}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { UnholdVoiceParticipant } from "@twilio/flex-sdk/actions/Voice";
*
* async function unholdParticipant() {
* const client = await createClient("SDK_TOKEN");
* const unholdVoiceParticipant = new UnholdVoiceParticipant("WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* await client.execute(unholdVoiceParticipant);
* }
* ```
*
* @public
*/
export declare class UnholdVoiceParticipant implements Action> {
constructor(targetParticipantSid: string, taskSid: string);
run(ctx: {}): Promise;
}
export { UserUpdateReason }
/**
* Validate a user session token
* @category Authentication
*
* @param accountSid - The Twilio account SID
* @param token - Your session token
*
* @returns - A promise that resolves with the token data
*
* @example
* ```ts
* import { validateToken } from "@twilio/flex-sdk";
*
* const tokenData = await validateToken("ACXXX", "TOKEN");
* ```
*
* @public
*/
export declare const validateToken: (accountSid: string, token: string) => Promise;
/**
* Returns the version of the SDK
* @public
*/
export declare const version: string;
/**
* Interface for controlling voice calls with mute, hold, disconnect, and recording capabilities.
* @public
*/
export declare interface VoiceCall {
/**
* @ignore
*/
call: Call | null;
/**
* @ignore
*/
device: Device;
/**
* Check if current call (if there is one) is on hold.
* @returns - A promise that resolves to a boolean indicating whether the call is on hold.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.VoiceReservationNotLiveCall}
* - {@link ErrorCode.CallInstanceUndefined}
* - {@link ErrorCode.VoiceReservationNotFound}
* - {@link ErrorCode.FailedToRetrieveTaskParticipants}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});
*
* const voiceCall = await client.execute(startOutboundCall);
*
* const isOnHold: boolean = await voiceCall.isOnHold();
* console.log(`Call ${isOnHold ? "is on hold" : "is not on hold"}`)
* ```
*/
isOnHold(): Promise;
/**
* Hang up current call (if there is one).
* @returns
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToDisconnectCall}
* - {@link ErrorCode.CallInstanceUndefined}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});
*
* const voiceCall = await client.execute(startOutboundCall);
*
* await voiceCall.disconnect();
* ```
*/
disconnect(): Promise;
/**
* Is current call muted
* @returns - A boolean indicating whether the call is muted
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.CallInstanceUndefined}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});
*
* const voiceCall = await client.execute(startOutboundCall);
*
* const isMuted: boolean = voiceCall.isMuted();
* console.log(`Call ${isMuted ? "is muted" : "is not muted"}`)
* ```
*/
isMuted(): boolean | undefined;
/**
* Mute current call
* @returns
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.CallInstanceUndefined}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});
*
* const voiceCall = await client.execute(startOutboundCall);
* voiceCall.mute();
*
* const isMuted: boolean = voiceCall.isMuted();
* console.log(`Call ${isMuted ? "is muted" : "is not muted"}`)
* ```
*/
mute(): void;
/**
* Unmute current call
* @returns
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.CallInstanceUndefined}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});
*
* const voiceCall = await client.execute(startOutboundCall);
* voiceCall.unmute();
*
* const isMuted: boolean = voiceCall.isMuted();
* console.log(`Call ${isMuted ? "is muted" : "is not muted"}`)
* ```
*/
unmute(): void;
/**
* Hold current call (if there is one).
* @param options - Options to specify hold music URL and HTTP method
*
* @returns - A promise that resolves to a `Task` object, representing the held task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.WorkerCannotHoldReservation}
* - {@link ErrorCode.CallInstanceUndefined}
* - {@link ErrorCode.FailedToHoldCall}
* - {@link ErrorCode.VoiceReservationNotFound}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});
*
* const voiceCall = await client.execute(startOutboundCall);
*
* await voiceCall.hold({ holdMusicUrl: "holdMusicUrl", holdMusicMethod: "GET" });
* ```
*/
hold(options?: HoldCallOptions): Promise;
/**
* Unhold current call (if there is one).
* @returns - A promise that resolves to a `Task` object, representing the unheld task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.WorkerCannotUnholdReservation}
* - {@link ErrorCode.CallInstanceUndefined}
* - {@link ErrorCode.FailedToUnholdCall}
* - {@link ErrorCode.VoiceReservationNotFound}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX", { fromNumber: "+1XXX", workflowSid: "WWXXX", taskQueueSid: "WQXXX"});
*
* const voiceCall = await client.execute(startOutboundCall);
*
* // Call is not on hold by default so to unhold, it is needed to hold first
* await call.hold("holdMusicUrl", "GET");
* await call.unhold();
* ```
*/
unhold(): Promise;
/**
* Resume recording current conference. This method will only resume an existing recording, it won't start a new one.
* @returns
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.NoConferenceSidFoundInTaskAttributes}
* - {@link ErrorCode.NoActiveRecordingToResume}
* - {@link ErrorCode.FailedToResumeRecording}
* - {@link ErrorCode.CallInstanceUndefined}
* - {@link ErrorCode.VoiceReservationNotFound}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX");
*
* const voiceCall = await client.execute(startOutboundCall);
*
* await voiceCall.resumeRecording();
* ```
*/
resumeRecording(): Promise;
/**
* Pause recording current conference (if there is one).
* @param pauseBehaviour - The behaviour to use when pausing the recording. Can be either "silence" or "skip". Default is "silence".
*
* @returns
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.NoConferenceSidFoundInTaskAttributes}
* - {@link ErrorCode.NoActiveRecordingToPause}
* - {@link ErrorCode.FailedToPauseRecording}
* - {@link ErrorCode.CallInstanceUndefined}
* - {@link ErrorCode.VoiceReservationNotFound}
* - {@link ErrorCode.WorkerNotInitialized}
*
* @example
* ```ts
* import { createClient, StartOutboundCall } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
* const startOutboundCall = new StartOutboundCall("+1XXX");
*
* const voiceCall = await client.execute(startOutboundCall);
*
* await voiceCall.pauseRecording("silence");
* ```
*/
pauseRecording(pauseBehaviour?: "silence" | "skip"): Promise;
}
/**
* Enumeration of voice event names that the Flex SDK client can listen to.
* @public
*/
export declare enum VoiceClientEvent {
Error = "error",
Incoming = "incoming",
Destroyed = "destroyed",
TokenWillExpire = "tokenWillExpire",
Unregistered = "unregistered"
}
/**
* Media properties specific to voice participants.
* @public
*/
export declare type VoiceMediaProperties = {
accountSid: string;
callSid: string;
coaching: boolean;
conferenceSid: string;
endConferenceOnExit: boolean;
friendlyName: string;
hold: boolean;
muted: boolean;
sequenceNumber: number;
timestamp: string;
startConferenceOnEnter: boolean;
statusCallbackEvent?: StatusCallbackEvent;
participantCallStatus?: ParticipantCallStatus;
reasonParticipantLeft?: ReasonParticipantLeft;
from?: string;
to?: string;
} & MediaProperties;
/**
* Options for handling voice calls.
* @public
*/
export declare interface VoiceOptions {
/**
* Auto accept incoming calls
* @defaultValue true
*/
autoAcceptIncomingCalls?: boolean;
}
/**
* Extends {@link BaseParticipant} with properties specific to voice participants.
* @public
*/
export declare type VoiceTaskParticipant = BaseParticipant & {
readonly channelType: MediaChannelType.Voice;
/**
* Media properties of the participant
*/
readonly mediaProperties?: VoiceMediaProperties | null;
/**
* Is participant on hold
*/
readonly isOnHold: boolean;
};
/**
* Without
* Constructs a type by forcing all properties from T that are not assignable to U to be undefined
* @public
*/
export declare type Without = Partial, never>>;
/**
* A wrapper for the TaskRouter Worker class.
* @public
*/
declare class Worker_2 extends Worker_3 {
constructor(token: string, options?: WorkerOptions_2);
}
export { Worker_2 as Worker }
/**
* Configuration Service
* Configuration for a Flex instance
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Default Worker attribute settings
* @public
*/
export declare interface WorkerChannel {
/**
* Unique name of the TaskChannel associated to this WorkerChannel
*/
name: string;
/**
* Default capacity value
*/
capacity: number;
/**
* Default availability
*/
availability: boolean;
}
export { WorkerEvents }
export { WorkerInfo }
export { WorkerOptions_2 as WorkerOptions }
export { Workspace }
export { WorkspaceOptions }
export { WrappingOptions }
/**
* Wraps up a task that is either pending or assigned.
* @category Actions
*
* @param taskSid - The unique identifier (SID) of the task to be completed.
*
* @returns A promise that resolves to a `Reservation` and a `Task` object representing the completed task.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToWrapUpReservation}
* - {@link ErrorCode.WorkerNotInitialized}
* - {@link ErrorCode.TaskReservationNotFound}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { WrapUpTask } from "@twilio/flex-sdk/actions/Task";
*
* async function wrapUpTask() {
* const client = await createClient("SDK_TOKEN");
* const wrapUpTask = new WrapUpTask("TSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const { task, reservation } = await client.execute(wrapUpTask);
* return { task, reservation };
* }
* ```
*
* @public
*/
export declare class WrapUpTask implements Action> {
constructor(taskSid: string);
run(ctx: {}): Promise<{
task: Task;
reservation: Reservation;
}>;
}
/**
* XOR
* Constructs a type that requires type T or U, but not both
* @public
*/
export declare type XOR = T | U extends object ? (Without & U) | (Without & T) : T | U;
export { }