TaskHelper
canKickWorkerParticipant(task, participant) => boolean#
Returns true if current worker can kick the worker participant in the live call task.
Parameters:
task: ITask
participant: ConferenceParticipant
Returns:
boolean
Example:
import { TaskHelper } from "@twilio/flex-ui";const canRemoveWorker = TaskHelper.canKickWorkerParticipant(someTask, participant);
isTaskAssignedToCurrentWorker(task) => boolean#
Returns if reservation associated with the task is assigned to the current user.
Parameters:
task: ITask
Returns:
boolean
Example:
import { TaskHelper } from "@twilio/flex-ui";const isTaskAssignedToCurrentWorker = TaskHelper.isTaskAssignedToCurrentWorker(someTask);
getTaskFromConversationSid(conversationSid) => ITask#
Returns a task which is associated with provided chat channel sid.
Parameters:
conversationSid: string
Unique identifier of the conversation.
Returns:
ITask | undefined
Example:
import { TaskHelper } from "@twilio/flex-ui";const task = TaskHelper.getTaskFromConversationSid("CHXXXXXXXXXXXXXXXXX");
isCBMTask(task) => boolean#
Returns true for tasks which include a Flex Interaction Channel SID in its attributes. Refers to tasks created using Flex Conversations.
Parameters:
task: ITask
Returns:
boolean
Example:
import { TaskHelper } from "@twilio/flex-ui";const isCBMTask = TaskHelper.isCBMTask(someTask);
findParticipant(task, channelSid, type) => Promise<(IParticipant|undefined)>#
Find the Participant from Task channel
Parameters:
task: ITask
channelSid: string
type: string
Returns:
Promise<(IParticipant|undefined)>
Example:
const agent = await TaskHelper.findParticipant(task, channelSid, ParticipantType.AGENT);
findParticipantByTaskSid(task, channelSid, type, options) => Promise<(IParticipant|undefined)>#
Find the Participant based on taskSid from Task channel
Parameters:
task: ITask
channelSid: string
type: string
options: object
Returns:
Promise<(IParticipant|undefined)>
Example:
const agent = await TaskHelper.findParticipantByTaskSid(task, channelSid, ParticipantType.AGENT);
chat: ConversationHelper#
Gets the helper for associated chat channel.
Example:
import { TaskHelper } from "@twilio/flex-ui";const taskHelper = new TaskHelper(someTask);console.log(taskHelper.chat);
durationSinceUpdate: string#
Duration since last update of a task. Uses dateUpdated
property of a task.
Example:
import { BaseTaskHelper } from "@twilio/flex-ui";const taskHelper = new BaseTaskHelper(someTask);console.log(taskHelper.durationSinceUpdate);
durationSinceUpdateShort: string#
Duration since last update of a task in short format. Uses dateUpdated
property of a task.
Example:
import { BaseTaskHelper } from "@twilio/flex-ui";const taskHelper = new BaseTaskHelper(someTask);console.log(taskHelper.durationSinceUpdateShort);
jsonString: string#
Serializes task object to json string.
Example:
import { TaskHelper } from "@twilio/flex-ui";const taskHelper = new TaskHelper(someTask);console.log(taskHelper.jsonString);