Properties:
Name | Type | Description |
---|---|---|
addOns |
Object | The addons attached to the Task |
age |
int | The age of the Task in seconds |
attributes |
Object | The attributes of the Task |
dateCreated |
Date | The date the Task was created |
dateUpdated |
Date | The date the Task was last updated |
priority |
int | The priority of the Task |
queueName |
string | The friendly name of the TaskQueue the Task is currently in |
queueSid |
string | The sid of the TaskQueue the Task is currently in |
reason |
string | The reason the Task was completed or canceled, if applicable |
routingTarget |
string | The target Sid of the Worker, TaskQueue, or Workflow this Task will be routed to. |
sid |
string | The sid of the Task |
status |
string | The status of the Task. Options: ['reserved', 'assigned', 'canceled', 'wrapping', 'completed', 'transferring'] |
taskChannelSid |
string | The sid of the Task Channel associated to the Task in MultiTask mode |
taskChannelUniqueName |
string | The unique name of the Task Channel associated to the Task in MultiTask mode |
timeout |
int | The number of seconds the Task is allowed to live |
transfers |
Transfers | The IncomingTransfer and OutgoingTransfer related to this Task, if applicable |
workflowName |
string | The name of the Workflow responsible for routing the Task |
workflowSid |
string | The sid of the Workflow responsible for routing the Task |
version |
string | The version of this Task |
Fires:
- Task#event:canceled
- Task#event:completed
- Task#event:transferAttemptFailed
- Task#event:transferCanceled
- Task#event:transferCompleted
- Task#event:transferFailed
- Task#event:transferInitiated
- Task#event:updated
- Task#event:wrapup
Methods
-
complete(reason)
-
Update the Task status to 'completed'
Parameters:
Name Type Description reason
string The reason for completing the Task
Returns:
- Rejected if the Task state could not be updated to 'completed'
- Type
- Promise.<this>
-
fetchLatestVersion()
-
Fetch the last version of this Task
Returns:
- Type
- Promise.<Task>
-
hold(targetWorkerSid, onHold [, options])
-
Hold the worker's call leg in the Conference associated to this Task and specified TargetWorkerSid
Parameters:
Name Type Argument Description targetWorkerSid
String The target worker's sid which should be put onhold or unhold
onHold
boolean Whether to hold or unhold the specified worker's call leg in the Conference referenced by the Task
options
Task.HoldOptions <optional>
-
kick(workerSid)
-
Kick another active Worker participant from the ongoing conference
Parameters:
Name Type Description workerSid
string The Sid of the Worker who is currently in the conference that should be kicked
Returns:
- Rejected if unable to kick the call leg of the targeted Worker in the Conference tied to the Task
- Type
- Promise.<this>
-
setAttributes(attributes)
-
Update the Task attributes to the given attributes.
Parameters:
Name Type Description attributes
Object A JSON to update the attributes.
Returns:
- Rejected if the attributes cannot be set
- Type
- Promise.<this>
-
transfer(to [, options])
-
Transfer the Task to another entity.
Parameters:
Name Type Argument Description to
string The Worker or TaskQueue entity sid to transfer the task to.
options
Task.TransferOptions <optional>
Returns:
- Type
- Promise.<this>
-
updateParticipant( [options])
-
Update the Customer leg in the Conference associated to this Task
Parameters:
Name Type Argument Description options
Task.ParticipantOptions <optional>
Returns:
- Rejected if unable to update the Customers's leg in the Conference tied to the Task
- Type
- Promise.<this>
-
wrapUp()
-
Update the Task status to 'wrapping' in a multi-task enabled Workspace
Returns:
- Rejected if the Task state could not be updated to 'wrapping'
- Type
- Promise.<this>
Type Definitions
-
HoldOptions
-
Type:
- Object
Properties:
Name Type Argument Default Description holdUrl
string <optional>
default Twilio hold music The URL endpoint to play when participant is on hold.
holdMethod
string <optional>
'GET' The HTTP method for the hold URL.
-
ParticipantOptions
-
Type:
- Object
Properties:
Name Type Argument Default Description hold
boolean <optional>
null Whether to hold the customer leg of the Conference referenced by the Task
holdUrl
string <optional>
default Twilio hold music The URL endpoint to play when participant is on hold.
holdMethod
string <optional>
'GET' The HTTP method for the hold URL.
-
TransferOptions
-
Type:
- Object
Properties:
Name Type Argument Default Description attributes
Object <optional>
Updated attributes for the task
mode
string <optional>
'WARM' 'WARM' or 'COLD'
priority
number <optional>
Updated priority for the task
-
WrappingOptions
-
Type:
- Object
Properties:
Name Type Argument Default Description reason
string <optional>
null The reason for wrapping up the Task
Events
-
canceled
-
The Task was canceled
Parameters:
Name Type Description task
Task The Task who was canceled
-
completed
-
The Task was completed
Parameters:
Name Type Description task
Task The Task who was completed
-
transferInitiated
-
An OutgoingTransfer has been initiated for Task
Parameters:
Name Type Description outgoingTransfer
OutgoingTransfer The currently in process OutgoingTransfer
-
updated
-
The attributes of this Task was updated
Parameters:
Name Type Description task
Task The Task whose attributes were updated
-
wrapup
-
The Task was wrapped up
Parameters:
Name Type Description task
Task The Task who was wrapped up