A Workspace is a container for your Tasks, Workers, TaskQueues, Workflows, and Activities. Each of these items exists within a single Workspace and is not shared across Workspaces. For example, if you were using TaskRouter to distribute tasks for two separate organizations in your business, you might create a Workspace for each organization.
Please note that a Flex project can only have a single Workspace.
A single Workspace can hold a variety of task types, priorities, and workers with a variety of capabilities. A contact center might collect waiting phone calls, pending cases, and incoming chat requests into a single Workspace. Some of the phone calls in the Workspace might require an agent who speaks English, while others require an agent who speaks Spanish. Some of the tasks might originate from high-value customers, giving them a higher priority, while other tasks can wait longer before resolution.
While we still support the creation of a single-tasking Workspace (legacy mode) we advise you to only create multi-tasking Workspaces.
We also encourage you to start the migration of all your existing single-tasking Workspaces to multi-tasking. Please be advised that once a Workspace has been migrated to multi-tasking it can longer be converted back to single-tasking.
Pagination is not supported under this resource. Please avoid usage of the page
query parameter.
The SID of the Account that created the Workspace resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
The SID of the Activity that will be used when new Workers are created in the Workspace.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The URL we call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See Workspace Events for more information. This parameter supports Twilio's Webhooks (HTTP callbacks) Connection Overrides.
The list of Workspace events for which to call event_callback_url
. For example, if EventsFilter=task.created, task.canceled, worker.activity.update
, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated.
The string that you assigned to describe the Workspace resource. For example Customer Support
or 2014 Election Campaign
.
Whether multi-tasking is enabled. The default is true
, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (true
), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at Multitasking.
The unique string that we created to identify the Workspace resource.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues. Can be: LIFO
or FIFO
and the default is FIFO
. For more information, see Queue Ordering.
FIFO
LIFO
The URLs of related resources.
POST https://taskrouter.twilio.com/v1/Workspaces
application/x-www-form-urlencoded
A descriptive string that you create to describe the Workspace resource. It can be up to 64 characters long. For example: Customer Support
or 2014 Election Campaign
.
The URL we should call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See Workspace Events for more information. This parameter supports Twilio's Webhooks (HTTP callbacks) Connection Overrides.
The list of Workspace events for which to call event_callback_url. For example, if EventsFilter=task.created, task.canceled, worker.activity.update
, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated.
Whether to enable multi-tasking. Can be: true
to enable multi-tasking, or false
to disable it. However, all workspaces should be created as multi-tasking. The default is true
. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (true
), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at Multitasking.
An available template name. Can be: NONE
or FIFO
and the default is NONE
. Pre-configures the Workspace with the Workflow and Activities specified in the template. NONE
will create a Workspace with only a set of default activities. FIFO
will configure TaskRouter with a set of default activities and a single TaskQueue for first-in, first-out distribution, which can be useful when you are getting started with TaskRouter.
The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues. Can be: LIFO
or FIFO
and the default is FIFO
. For more information, see Queue Ordering.
FIFO
LIFO
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createWorkspace() {11const workspace = await client.taskrouter.v1.workspaces.create({12eventCallbackUrl: "https://workspace-example.free.beeceptor.com",13friendlyName: "NewWorkspace",14template: "FIFO",15});1617console.log(workspace.accountSid);18}1920createWorkspace();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2016-08-01T22:10:40Z",4"date_updated": "2016-08-01T22:10:40Z",5"default_activity_name": "Offline",6"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"event_callback_url": "https://workspace-example.free.beeceptor.com",8"events_filter": null,9"friendly_name": "NewWorkspace",10"links": {11"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",12"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",13"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",14"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",15"task_queues": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues",16"tasks": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks",17"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",18"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows",19"task_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels",20"events": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events"21},22"multi_task_enabled": false,23"prioritize_queue_order": "FIFO",24"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"timeout_activity_name": "Offline",26"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"default_operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"29}
GET https://taskrouter.twilio.com/v1/Workspaces/{Sid}
The SID of the Workspace resource to fetch.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchWorkspace() {11const workspace = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.fetch();1415console.log(workspace.accountSid);16}1718fetchWorkspace();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2016-08-01T22:10:40Z",4"date_updated": "2016-08-01T22:10:40Z",5"default_activity_name": "Offline",6"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"event_callback_url": "",8"events_filter": null,9"friendly_name": "new",10"links": {11"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",12"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",13"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",14"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",15"task_queues": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues",16"tasks": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks",17"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",18"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows",19"task_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels",20"events": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events"21},22"multi_task_enabled": false,23"prioritize_queue_order": "FIFO",24"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"timeout_activity_name": "Offline",26"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"default_operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"29}
GET https://taskrouter.twilio.com/v1/Workspaces
By default, this will return the first 50 Workspaces. Supply a PageSize parameter to fetch more than 50 Workspaces. See pagination information for more information.
The friendly_name
of the Workspace resources to read. For example Customer Support
or 2014 Election Campaign
.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listWorkspace() {11const workspaces = await client.taskrouter.v1.workspaces.list({ limit: 20 });1213workspaces.forEach((w) => console.log(w.accountSid));14}1516listWorkspace();
1{2"meta": {3"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces?FriendlyName=friendly_name&PageSize=50&Page=0",4"key": "workspaces",5"next_page_url": null,6"page": 0,7"page_size": 50,8"previous_page_url": null,9"url": "https://taskrouter.twilio.com/v1/Workspaces?FriendlyName=friendly_name&PageSize=50&Page=0"10},11"workspaces": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"date_created": "2016-08-01T22:10:40Z",15"date_updated": "2016-08-01T22:10:40Z",16"default_activity_name": "Offline",17"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"event_callback_url": "",19"events_filter": null,20"friendly_name": "new",21"links": {22"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",23"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",24"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",25"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",26"task_queues": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues",27"tasks": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks",28"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",29"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows",30"task_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels",31"events": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events"32},33"multi_task_enabled": false,34"prioritize_queue_order": "FIFO",35"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",36"timeout_activity_name": "Offline",37"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",38"default_operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",39"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"40}41]42}
POST https://taskrouter.twilio.com/v1/Workspaces/{Sid}
The SID of the Workspace resource to update.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
The SID of the Activity that will be used when new Workers are created in the Workspace.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The URL we should call when an event occurs. See Workspace Events for more information. This parameter supports Twilio's Webhooks (HTTP callbacks) Connection Overrides.
The list of Workspace events for which to call event_callback_url. For example if EventsFilter=task.created,task.canceled,worker.activity.update
, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated.
A descriptive string that you create to describe the Workspace resource. For example: Sales Call Center
or Customer Support Team
.
Whether to enable multi-tasking. Can be: true
to enable multi-tasking, or false
to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at Multitasking.
The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues. Can be: LIFO
or FIFO
. For more information, see Queue Ordering.
FIFO
LIFO
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateWorkspace() {11const workspace = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.update({14eventCallbackUrl: "https://new-workspace-callback.free.beeceptor.com",15friendlyName: "NewWorkspaceName",16});1718console.log(workspace.accountSid);19}2021updateWorkspace();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2016-08-01T22:10:40Z",4"date_updated": "2016-08-01T22:10:40Z",5"default_activity_name": "Offline",6"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"event_callback_url": "https://new-workspace-callback.free.beeceptor.com",8"events_filter": null,9"friendly_name": "NewWorkspaceName",10"links": {11"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",12"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",13"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",14"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",15"task_queues": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues",16"tasks": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks",17"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",18"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows",19"task_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels",20"events": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events"21},22"multi_task_enabled": false,23"prioritize_queue_order": "FIFO",24"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"timeout_activity_name": "Offline",26"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"default_operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"29}
DELETE https://taskrouter.twilio.com/v1/Workspaces/{Sid}
The SID of the Workspace resource to delete.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteWorkspace() {11await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.remove();14}1516deleteWorkspace();
Every Workspace supports the following subresources.
/v1/Workspaces/{WorkspaceSid}/Workers
Represents the resources that can process Tasks from this Workflow, such as agents in a call center or people working a help desk. See the Worker Resource for more information.
/v1/Workspaces/{WorkspaceSid}/Activities
A worker's availability to handle a task is controlled by its Activity. Activities describe what a worker is currently doing and provide a meaningful label for real-time worker statistics. See the Activity Resource for more information.
/v1/Workspaces/{WorkspaceSid}/TaskQueues
TaskQueues hold tasks that are waiting to be assigned to Workers. Each TaskQueue specifies the capabilities workers must have to receive tasks from the queue. See TaskQueues for more information.
/v1/Workspaces/{WorkspaceSid}/Workflows
Workflows control how Tasks will be prioritized and routed to queues. Workflows can also escalate a Task's priority, move a Task to another queue after a timeout, or remove a Task from the Workspace entirely if it has not been assigned within some timeout. All Tasks enter the Workspace through a Workflow and will be managed by a Workflow until they are either assigned to a Worker or removed from the Workspace. See the Workflow Resource for more information.
/v1/Workspaces/{WorkspaceSid}/Tasks
Represents the Tasks waiting in this Workspace. See the Task Resource for more information.
/v1/Workspaces/{WorkspaceSid}/Statistics
Statistics are captured for each of TaskRouter's subresources. You can use these Statistics to build reporting dashboards and displays for your team. See Workspace Statistics for more information.
/v1/Workspaces/{WorkspaceSid}/Events
Events describe changes to your Workspace. Use these Events to build historical reports for your TaskRouter environment. See the Event Resource for more information.