Twilio TaskRouter is a system for distributing tasks such as phone calls, leads, support tickets, and other work items to the people and processes that can best handle them. Example applications for TaskRouter include:
Want to get started quickly? Dive into the TaskRouter QuickStart.
A TaskRouter Workspace is composed of many entities that work together to enable a Task to match a Worker, someone who can take action on the pending Task. This is accomplished through a few steps:
Each step taken by TaskRouter emits Events which log all activity within the Workspace. These events can be used for reporting, or applications can subscribe to the events and trigger new actions.
The JavaScript SDK is the recommended method for interacting with TaskRouter. Most TaskRouter applications display Task information to agents in a front-end application. The SDK simplifies the process for listening to TaskRouter events and eliminates roundtrips to a backend application attempting to coordinate all TaskRouter activity.
A typical TaskRouter application will:
reservation.created
, to identify when a Worker has been matched to a TaskIn addition, applications can listen to Event Callbacks. These JSON web requests cover a wider range of events, and they can be used by back-end services to track information across an entire Workspace. These callbacks can be useful to generate realtime reporting dashboards by aggregating event information, like worker.activity.update
and task.completed
events.
TaskRouter is a powerful tool when combined with other Twilio products. For Tasks that represent voice calls, TaskRouter can tie the lifecycle of a call to the lifecycle of a Task. This is particularly useful for automatically adding the assigned Worker as a participant in a Conference with an inbound caller.
Queueing Twilio Calls provides more detail on how to setup these integrations.
A TaskRouter Workspace is multitasking by default. A Worker's capacity (defined by their WorkerChannels) determines if they can handle three simultaneous chats, a voice call and a chat, or only one voice call.
TaskRouter uses a Worker's capacity and their Activity to determine if they are available for a new Task. When TaskRouter is assigning a Task through a Workflow, it will:
Available
activity and have remaining capacity on the Task's channelSetup: Create Workers with the appropriate attributes, a TaskQueue associated with the Workers, and a Workflow to control Task assignment and escalation rules.
Put all Workers in Offline
Create a new Task. The Task will sit in queue until a matching Worker is available.
Update a Worker to an Available
activity
TaskRouter identifies the available Worker and creates a Reservation pairing the Worker with the Task. The Worker's capacity is taken by the pending Reservation.
TaskRouter emits a reservation.created
event to the JS SDK and as an Event Callback.
Respond to the JS event to accept the Reservation.
<Enqueue>
, accept with a conference
instruction to automatically bridge the Worker into a Conference with the inbound caller.Complete the Task from the JS SDK once the Worker is finished. The Worker's capacity is released. The process repeats as new Tasks are created.
Update the Worker to Offline
to end their shift.
Want to get started quickly? Dive into the TaskRouter QuickStart.