Skip to contentSkip to navigationSkip to topbar
On this page

TaskRouter Events Reference


TaskRouter will make an HTTP request containing Event details to the Workspace's EventCallbackURL each time an Event takes place. This page contains a full list of Events and a description of Event Callbacks.

(warning)

Warning

A busy TaskRouter system will generate a large volume of Events at a frequent rate. Keep this in mind when considering how your application will scale.


Event Callbacks

event-callbacks page anchor

The EventCallbackUrl is defined on the Workspace. Your application should respond to Event Callbacks with 204 No Content and a Content-Type header of application/json within 15 seconds.

TaskRouter will POST the following parameters to the EventCallbackURL configured on your Workspace each time an Event occurs.

ParameterDescription
EventTypeAn identifier for this event
AccountSidThe account owning this event
WorkspaceSidThe Workspace Sid generating this event
WorkspaceNameThe Workspace Name generating this event (📇 PII )
EventDescriptionA description of the event (📇 PII )
ResourceTypeThe type of object this event is most relevant to (Task, Reservation, Worker, Activity, Workflow, Workspace)
ResourceSidThe sid of the object this event is most relevant to (TaskSid, ReservationSid, WorkerSid, ActivitySid, WorkflowSid, WorkspaceSid)
TimestampThe time this event was sent

Activity

activity page anchor

Events

events page anchor
EventTypeField DataDescription
activity.createdActivitySid ActivityName ActivityAvailableAn Activity is created
activity.updatedActivitySid ActivityName ActivityAvailableAn Activity is created
activity.deletedActivitySid ActivityName ActivityAvailableAn Activity is deleted
EventTypeField DataDescription
reservation.createdTask Worker TaskQueueSid ReservationSid WorkflowSidA task is assigned to a worker
reservation.acceptedTask Worker TaskQueueSid ReservationSid WorkflowSidA task reservation is accepted by a worker
reservation.rejectedTask Worker TaskQueueSid ReservationSid WorkflowSidA task reservation is rejected by a worker
reservation.timeoutTask Worker TaskQueueSid ReservationSid WorkflowSidToo much time passed without a task being accepted or rejected. The reservation is canceled.
reservation.canceledTask Worker TaskQueueSid ReservationSid WorkflowSidA task reservation is canceled before it has been accepted by a worker
reservation.rescindedTask Worker TaskQueueSid ReservationSid WorkflowSidMulti-reservation was used for a task and another worker has accepted one of the created reservations
reservation.completedTask Worker TaskQueueSid ReservationSid WorkflowSidA task reservation is completed. Aligns with task.completed.
reservation.failedTask TaskQueueSid ReservationSid WorkflowSidThe reservation failed and was not assigned to an agent.
reservation.wrapupTask Worker TaskQueueSid ReservationSid WorkflowSidThe task reservation is being wrapped up by the agent; happens directly before task completion.
EventTypeField DataDescription
task.createdTask WorkflowSidA task item is added to a Workspace
task.updatedTask TaskQueueSid WorkflowSidA task's attributes are changed
task.canceledTask TaskQueueSid WorkflowSidA task is canceled
task.wrapupTask TaskQueueSid WorkflowSidA task is moved to wrapup state.
task.completedTask TaskQueueSid WorkflowSidA task is completed
task.deletedTask TaskQueueSid WorkflowSidA task is deleted via API. Does not include auto-deleted Tasks after cancelation/completion.
task.system-deletedTask TaskQueueSid WorkflowSidA task is deleted via the system, after the task reaches its TTL.
task.transfer-initiatedTask TaskQueueSid WorkflowSid
task.transfer-attempt-failedTask TaskQueueSid WorkflowSid
task.transfer-failedTask TaskQueueSid WorkflowSid
task.transfer-canceledTask TaskQueueSid WorkflowSid
task.transfer-completedTask TaskQueueSid WorkflowSid

When an event involving a Task is logged, the event callback will include the following fields.

ParameterDescription
TaskSidThe SID of the task that changed
TaskAttributesThe JSON Attributes of the task (📇 PII )
TaskAgeThe age of the task
TaskPriorityThe priority of the task
TaskAssignmentStatusThe assignment status of the task
TaskCanceledReasonThe reason that task was canceled
TaskCompletedReasonThe reason that task was completed
EventTypeField DataDescription
task-channel.createdTaskChannelA task channel is created
task-channel.updatedTaskChannelA task channel is updated
task-channel.deletedTaskChannelA task channel is deleted

When an event comes in that relates to a Task Channel, the following fields will be passed in:

ParameterDescription
TaskChannelSidThe SID of the task-channel
TaskChannelNameThe Friendly Name of the task-channel (📇 PII )
TaskChannelUniqueNameAn application-defined string that uniquely identifies the Task Channel, such as voice or sms
TaskChannelOptimizedRoutingWhether the Task Channel should prioritize Workers that have been idle. If true, Workers that have been idle the longest are prioritized.
EventTypeField DataDescription
task-queue.createdTaskQueueSid TaskQueueName TaskQueueTargetExpression OperatingUnitSidA TaskQueue has been created
task-queue.deletedTaskQueueSid TaskQueueName TaskQueueTargetExpressionA TaskQueue has been deleted
task-queue.enteredTask TaskQueueSid WorkflowSidA task enters a queue during workflow processing
task-queue.timeoutTask TaskQueueSid WorkflowSidA workflow routing step timed-out and a task is leaving a queue
task-queue.movedTask TaskQueueSid WorkflowSidA task leaves its current queue to move to a new queue during workflow processing
task-queue.expression.updatedTaskQueueSid TaskQueueTargetExpressionThe queue expression has been updated
EventTypeField DataDescription
worker.createdWorkerA worker is created
worker.activity.updateWorkerA worker's activity is updated
worker.attributes.updateWorkerA worker's attributes are updated
worker.capacity.updateWorker ChannelA worker's channel's configured capacity has been updated
worker.channel.availability.updateWorker ChannelA worker's channel's availability has been updated
worker.deletedWorkerA worker is deleted

When an event comes in that relates to a Worker, the following fields will be passed in:

ParameterDescription
WorkerSidThe SID of the worker that changed
WorkerNameThe Friendly Name of the worker (📇 PII )
WorkerAttributesThe JSON Attributes of the worker (📇 PII )
WorkerActivitySidThe new activity SID of the worker
WorkerActivityNameThe new activity friendly name of the worker
WorkerVersionThe current worker version
OperatingUnitSidThe SID of the operating unit to which the worker belongs

When an event comes in that relates to a Worker's activity changing, the following additional fields will be passed in:

ParameterDescription
WorkerTimeInPreviousActivityThe time spent in the previous activity, in seconds; truncated to zero decimals
WorkerTimeInPreviousActivityMsThe time spent in previous activity , in milliseconds
WorkerPreviousActivitySidThe previous activity sid prior to this state change

When an event comes in that relates to a Worker's configured channel capacity or availability changing, the following additional fields will be passed in:

ParameterDescription
WorkerChannelAvailableThe availability of the channel
WorkerChannelAvailableCapacityThe available capacity of the channel
WorkerChannelPreviousCapacityThe previous capacity of the channel
TaskChannelSidThe associated channel sid
TaskChannelUniqueNameThe associated channel unique name
WorkerChannelTaskCountThe number of assigned tasks to this worker on this channel
EventTypeField DataDescription
workflow.createdWorkflowSid WorkflowNameA workflow is created
workflow.updatedWorkflowSid WorkflowNameA workflow is updated
workflow.deletedWorkflowSid WorkflowNameA workflow is deleted
workflow.target-matchedTask WorkflowSidA task item matches a workflow routing step
workflow.enteredTask WorkflowSidA task enters a workflow
workflow.timeoutTask WorkflowSidA task reaches the end of a workflow without being accepted and is removed from the workspace
workflow.skippedTask WorkflowSidA task skips-out of the workflow (because of skip_if in the final step) and is removed from the workspace
EventTypeField DataDescription
workspace.createdWorkspaceSid WorkspaceNameA workspace is created
workspace.updatedWorkspaceSid WorkspaceNameA workspace is updated
workspace.deletedWorkspaceSid WorkspaceNameA workspace is deleted

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.