///
import { ContentTemplateVariable } from '@twilio/conversations';
import { Conversation as Conversation_2 } from '@twilio/conversations';
import { ConversationUpdateReason } from '@twilio/conversations';
import { Message } from '@twilio/conversations';
import { MessageUpdateReason } from '@twilio/conversations';
import { Paginator as Paginator_2 } from '@twilio/conversations';
import { Participant } from '@twilio/conversations';
import { ParticipantUpdateReason } from '@twilio/conversations';
import { PushNotification } from '@twilio/conversations';
import { Supervisor as Supervisor_2 } from 'twilio-taskrouter';
import { Task } from 'twilio-taskrouter';
import type TypedEmitter from 'typed-emitter';
import { User } from '@twilio/conversations';
import { UserUpdateReason } from '@twilio/conversations';
import { WorkerOptions as WorkerOptions_2 } from 'twilio-taskrouter';
import { Workspace } from 'twilio-taskrouter';
/**
* 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;
}
/**
* 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;
}
/**
* The WhatsApp approval request status of a Content resource.
* @public
*/
export declare interface ApprovalRequests {
name?: string | null;
category?: string | null;
contentType?: string | null;
status?: string | null;
rejectionReason?: string | null;
allowCategoryChange?: boolean | null;
}
/**
* 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;
}
/**
* Main interface for interacting with the Flex SDK.
* @public
*/
export declare interface Client extends TypedEmitter {
readonly roles: Array;
readonly token: string;
/**
* The current aggregate connection state of the SDK.
* Reflects network health and the state of all initialized SDKs (Conversations, Voice, TaskRouter).
* SDK fields are `undefined` when that SDK has not yet been initialized.
*
* @example
* ```ts
* const { overall, network, conversations, voice, taskrouter } = client.connectionState;
* ```
*/
readonly connectionState: SdkConnectionState;
/**
* @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;
/**
* This method updates the token for the session and propagates it to all connected services.
* After a successful update, the `tokenUpdated` event is emitted with both the new token and refresh token.
*
* Use this method when you need to manually refresh the token, such as when your
* application receives a new token from your backend token server.
*
* @param token - The new authentication token
* @param refreshToken - The new refresh token (optional)
*
* @example
* Listen to token update events:
* ```ts
* import { createClient, ClientEvent } from "@twilio/flex-sdk";
*
* const client = await createClient("SDK_TOKEN");
*
* // Listen for token updates
* client.on(ClientEvent.TokenUpdated, (token, refreshToken) => {
* console.log("Token updated successfully");
* // Optionally store the new token
* });
*
* // Update the token
* client.updateToken("NEW_TOKEN", "NEW_REFRESH_TOKEN");
* ```
*/
updateToken(token: string, refreshToken?: 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",
ConnectionStateChanged = "connectionStateChanged"
}
/**
* Events that the Flex SDK client can emit.
* @public
*/
export declare interface ClientEventsType {
tokenUpdated: (token: string, refreshToken?: string) => void;
tokenAutoUpdateFailed: () => void;
tokenMaxLifetimeReached: (newTokenDateExpired: Date) => void;
clientDestroyed: () => void;
connectionStateChanged: (state: SdkConnectionState) => void;
[key: string]: (...args: any[]) => void;
}
/**
* Interface containing information about connection errors encountered when interacting with Twilio Conversations.
* @public
*/
export declare interface ConnectionError {
terminal: boolean;
message: string;
}
/**
* The state of a single SDK or the network connection.
* @public
*/
export declare type ConnectionState = "connected" | "connecting" | "disconnected" | "notInitialized";
/**
* A Twilio Content template with its WhatsApp approval request status.
* @public
*/
export declare interface ContentTemplate {
sid?: string | null;
accountSid?: string | null;
friendlyName?: string | null;
language?: string | null;
variables?: object | null;
types?: object | null;
approvalRequests?: ApprovalRequests | null;
dateCreated?: Date | null;
dateUpdated?: Date | null;
}
export { ContentTemplateVariable }
/**
* 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: Conversation_2;
/**
* 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: Participant) => void;
participantLeft: (participant: Participant) => void;
participantUpdated: (data: {
participant: Participant;
updateReasons: ParticipantUpdateReason[];
}) => void;
messageAdded: (message: Message) => void;
messageRemoved: (message: Message) => void;
messageUpdated: (data: {
message: Message;
updateReasons: MessageUpdateReason[];
}) => void;
tokenAboutToExpire: () => void;
tokenExpired: () => void;
typingEnded: (participant: Participant) => void;
typingStarted: (participant: Participant) => void;
pushNotification: (pushNotification: PushNotification) => void;
userSubscribed: (user: User) => void;
userUnsubscribed: (user: User) => void;
userUpdated: (data: {
user: User;
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;
/**
* 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;
}
/**
* 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 coach call due to internal error
*/
FailedToCoachCall = 48448,
/**
* Failed to barge call due to internal error
*/
FailedToBargeCall = 48449,
/**
* Supervisor is not currently on the call (call MonitorCall first)
*/
SupervisorNotOnCall = 48450,
/**
* 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,
/**
* Failed to retrieve content templates
*/
FailedToRetrieveContentTemplates = 48529,
/**
* Failed to get channel for task due to internal error
*/
FailedToGetChannelsForTask = 48530,
/**
* 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"
}
/**
* 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;
}
/**
* Retrieves a paginated list of Twilio Content templates with their WhatsApp approval request statuses.
* @category Actions
*
* @param options - Optional filter and pagination parameters.
*
* @returns A promise that resolves to a paginator containing content templates with approval statuses.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToRetrieveContentTemplates}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetContentTemplates } from "@twilio/flex-sdk/actions/Conversation";
*
* async function getContentTemplates() {
* const client = await createClient("SDK_TOKEN");
* const action = new GetContentTemplates({ pageSize: 20, language: ["en"] });
* const result = await client.execute(action);
* console.log(result.items);
* if (result.hasNextPage) {
* const nextPage = await result.nextPage();
* }
* }
* ```
*
* @public
*/
export declare class GetContentTemplates implements Action>> {
constructor(options?: GetContentTemplatesOptions);
private fetchPage;
run(ctx: {}): Promise>;
}
/**
* Options for filtering and paginating the content templates list.
* @public
*/
export declare interface GetContentTemplatesOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** The page token for pagination. Provided by the API on prior responses. */
pageToken?: string;
/** Sort by ascending or descending date updated. */
sortByDate?: string;
/** Sort by ascending or descending content name. */
sortByContentName?: string;
/** Filter to resources created after this date-time (inclusive). */
dateCreatedAfter?: string;
/** Filter to resources created before this date-time (inclusive). */
dateCreatedBefore?: string;
/** Filter by Regex Pattern in content name. */
contentName?: string;
/** Filter by Regex Pattern in template content. */
content?: string;
/** Filter by array of valid language(s). */
language?: string[];
/** Filter by array of contentType(s). */
contentType?: string[];
/** Filter by array of ChannelEligibility(s), where ChannelEligibility=channel:status. */
channelEligibility?: string[];
}
/**
* Retrieves a Conversation by its SID.
* @category Actions
*
* @param conversationSid - The SID of the conversation to retrieve.
*
* @returns A promise that resolves to the Conversation object.
*
* @throws {@link FlexSdkError} with the following error code(s):
* - {@link ErrorCode.FailedToRetrieveConversation}
* - {@link ErrorCode.FailedToInitializeConversationsSDK}
* - {@link ErrorCode.MissingRequiredParameter}
*
* @example
* ```ts
* import { createClient } from "@twilio/flex-sdk";
* import { GetConversationBySid } from "@twilio/flex-sdk/actions/Conversation";
*
* async function getConversation() {
* const client = await createClient("SDK_TOKEN");
* const getConversation = new GetConversationBySid("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
* const conversation = await client.execute(getConversation);
* return conversation;
* }
* ```
*
* @public
*/
export declare class GetConversationBySid implements Action> {
constructor(conversationSid: string);
/**
*
* @ignore
*/
run(ctx: {}): Promise;
}
/**
* 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 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;
}
/**
* 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;
}
/**
* 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;
};
/**
* Direction for retrieving messages from a conversation timeline.
* @public
*/
export declare enum MessagesDirection {
Backwards = "backwards",
Forward = "forward"
}
/**
* @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>;
}
/**
* 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"
}
/**
* 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"
}
/**
* 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;
}
/**
* 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"
}
/**
* 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;
}
/**
* 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);
}
/**
* Aggregate connection state of the Flex SDK, combining network and all initialized SDKs.
* SDK fields are `"notInitialized"` when that SDK has not been started yet.
* @public
*/
export declare interface SdkConnectionState {
overall: ConnectionState;
network: "connected" | "disconnected";
conversations: ConnectionState;
voice: ConnectionState;
taskrouter: ConnectionState;
}
/**
* 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 text messages in a conversation.
* @public
*/
export declare interface SendTextMessageOptions {
body: string;
messageAttributes?: any;
attachedFiles?: File[];
}
/**
* 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 {
}
/**
* 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;
}
/**
* 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);
}
/**
* Union of the {@link VoiceTaskParticipant} and {@link ConversationTaskParticipant} types.
* @public
*/
export declare type TaskParticipant = VoiceTaskParticipant | ConversationTaskParticipant;
/**
* 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;
};
/**
* Connection states for Twilio Conversations websocket connections.
* @public
*/
export declare type TwilsockConnectionState = "connected" | "disconnected" | "connecting" | "denied" | "tokenExpired" | "connectionError";
/**
* 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;
/**
* 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;
};
export { }