Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Task Queue Resource


(warning)

Warning

Pagination is not supported under this resource. Please avoid usage of the page query parameter.

TaskQueues allow you to categorize Tasks and describe which Workers are eligible to handle those Tasks. As your Workflows process Tasks, those Tasks will pass through one or more TaskQueues until the Task is assigned and accepted by an eligible Worker. TargetWorkers expressions, described below, control which Workers are eligible to receive Tasks from a given TaskQueue.


Task Assignment Precedence

task-assignment-precedence page anchor

A TaskQueue will distribute Tasks to any Worker in an 'available' activity that meets the TaskQueue's TargetWorkers criteria. Tasks will be assigned in the following order:

  • Higher priority tasks are always assigned before lower priority tasks, regardless of the age of the lower-priority tasks.
  • Among tasks of the same priority, the oldest task will always be assigned first.

TaskQueues and Activities

taskqueues-and-activities page anchor

In a multitasking Workspace, a Worker's status does not change as they are assigned and complete Tasks. A Worker's ability to accept a new Task is informed by their active capacity. For single-tasking Workspaces, a Worker is available for a Task based on their activity status. The AssignmentActivitySid and ReservationActivitySid properties can be used to control a Worker's availability during assignment.

When a TaskQueue reserves a Worker for a Task, it places the Worker in the ReservationActivitySid status. If the Worker accepts the Task, the Worker is placed in the AssignmentActivitySid status.

Note that in a single-tasking Workspace, when a Task completes, the Worker's activity does not change. This is because whether or not a Task's completion should change a Worker's activity is dependent on the workflow—the system needs confirmation of the Worker's availability before it will assign Tasks to them again. If this is the experience you want, the easiest way to achieve this is to capture the "task.completed" event and issue an update to the associated Worker's activity at that point.



List all TaskQueues

action-list page anchor

Resource URI

resource-uri page anchor

_10
GET /v1/Workspaces/{WorkspaceSid}/TaskQueues

Returns the list of TaskQueues in the workspace identified by {WorkspaceSid}.

Example

example page anchor

List all TaskQueues in a Workspace

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
import twilio from "twilio";
_14
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = twilio(accountSid, authToken);
_14
_14
const taskQueues = await client.taskrouter.v1
_14
.workspaces("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_14
.taskQueues.list({ limit: 20 });
_14
_14
taskQueues.forEach((t) => console.log(t.accountSid));

Output

_40
{
_40
"meta": {
_40
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues?EvaluateWorkerAttributes=evaluate_worker_attributes&FriendlyName=friendly_name&PageSize=50&Page=0",
_40
"key": "task_queues",
_40
"next_page_url": null,
_40
"page": 0,
_40
"page_size": 50,
_40
"previous_page_url": null,
_40
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues?EvaluateWorkerAttributes=evaluate_worker_attributes&FriendlyName=friendly_name&PageSize=50&Page=0"
_40
},
_40
"task_queues": [
_40
{
_40
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73",
_40
"assignment_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"date_created": "2015-08-04T01:31:41Z",
_40
"date_updated": "2015-08-04T01:31:41Z",
_40
"friendly_name": "81f96435-3a05-11e5-9f81-98e0d9a1eb73",
_40
"max_reserved_workers": 1,
_40
"links": {
_40
"assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",
_40
"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",
_40
"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",
_40
"list_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/Statistics",
_40
"bulk_real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/RealTimeStatistics"
_40
},
_40
"reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73",
_40
"reservation_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"target_workers": null,
_40
"task_order": "FIFO",
_40
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_40
"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_40
}
_40
]
_40
}

The following GET query string parameters allow you to limit the list returned. Note, parameters are case-sensitive:

FieldDescription
FriendlyNameAccepts a human-readable description of a TaskQueue (for example "Customer Support" or "2014 Election Campaign") and returns the matching Queue.
EvaluateWorkerAttributesAccepts a Worker attribute expression and returns the list of TaskQueues that would distribute tasks to a worker with these attributes.
WorkerSidAccepts a Worker SID, and returns the list of TaskQueues matched by a given Worker.

Note: By default, this will return the first 50 TaskQueues. Supply a PageSize parameter to fetch more than 50 TaskQueues. See paging for more information.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
const taskQueue = await client.taskrouter.v1
_19
.workspaces("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_19
.taskQueues.create({
_19
assignmentActivitySid: "WA21d51f4c72583766988f9860de3e130a",
_19
friendlyName: "English",
_19
reservationActivitySid: "WAea296a56ebce4bfbff0e99abadf16934",
_19
targetWorkers: 'languages HAS "english"',
_19
});
_19
_19
console.log(taskQueue.accountSid);

Output

_27
{
_27
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73",
_27
"assignment_activity_sid": "WA21d51f4c72583766988f9860de3e130a",
_27
"date_created": "2015-08-04T01:31:41Z",
_27
"date_updated": "2015-08-04T01:31:41Z",
_27
"friendly_name": "English",
_27
"max_reserved_workers": 1,
_27
"links": {
_27
"assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",
_27
"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",
_27
"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",
_27
"list_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/Statistics",
_27
"bulk_real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/RealTimeStatistics"
_27
},
_27
"reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73",
_27
"reservation_activity_sid": "WAea296a56ebce4bfbff0e99abadf16934",
_27
"sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"target_workers": "languages HAS \"english\"",
_27
"task_order": "FIFO",
_27
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_27
}

Required Parameters
required-post-parameters page anchor
FieldDescription
FriendlyNameHuman readable description of this TaskQueue (for example "Support - Tier 1", "Sales" or "Escalation") (📇 PII )
FieldDescription
AssignmentActivitySidActivitySID to assign workers once a task is assigned for them (🏢 not PII )
MaxReservedWorkersThe maximum amount of workers to create reservations for the assignment of a task while in this queue. Defaults to 1, with a Maximum of 50. (🏢 not PII )
TargetWorkersA string describing the Worker selection criteria for any Tasks that enter this TaskQueue. For example '"language" == "spanish"'. Additional details on Workers expressions below. Defaults to 1==1. (🏢 not PII )
TaskOrderTaskOrder will determine which order the Tasks will be assigned to Workers. Set this parameter to LIFO to assign most recently created Task first or FIFO to assign the oldest Task. Default is FIFO. Click here to learn more. (🏢 not PII )
ReservationActivitySidActivitySID to assign workers once a task is reserved for them (🏢 not PII )

Note: The maximum amount of TaskQueues allowed for any given Workspace is 5,000. Please contact us(link takes you to an external page) if your use case will require more.

TargetWorkers: Describing Worker Selection Criteria

target-workers page anchor
(warning)

Do not use Personally Identifiable Information for Worker identity

Using TargetWorkers, you can target individual Workers. You should not use directly identifying information (aka personally identifiable information or PII) like a person's name, home address, email or phone number, etc., because the systems that will process these Queues assume there is no directly identifying information within the TargetWorkers expression.

Instead, you should use a GUID or other pseudonymized identifier for Worker identity. You can read more about how we process your data in our privacy policy.

TaskRouter binds Workers to TaskQueues using the TaskQueue's TargetWorkers expression. TargetWorkers uses an SQL-like expression syntax to filter the Workers in the Workspace.

For example, let's say we have two agents. The first worker, Alice, speaks English and handles Support and Sales Tasks. This is modeled with the following attributes:


_10
{ "skills": ["support", "sales"], "languages":["english"]}

The second worker, Bob, handles only Sales requests and speaks Spanish and English:


_10
{"skills": ["sales"], "languages": ["spanish", "english"]}

Given these Workers, we can write a TargetWorkers expression to route calls only to Workers with the Support skill who speak English:


_10
(skills HAS "support") AND (languages HAS "english")

Only Alice would receive tasks from this TaskQueue. We could create a second TaskQueue to route calls to anyone with the Spanish language skill with the TargetWorkers expression:


_10
(languages HAS "spanish")

And only Bob would receive tasks from this TaskQueue.

To create TaskQueues with the TargetWorkers expressions explained above, you could issue the following requests:

For the English Support TaskQueue:


_10
curl https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/TaskQueues \
_10
-d FriendlyName=EnglishSupport \
_10
-d TargetWorkers='(skills HAS "support") AND (languages HAS "english")' \
_10
-d AssignmentActivitySid={ActivitySid}
_10
-d ReservationActivitySid={ActivitySid}
_10
-u {AccountSid}:{AuthToken}

For the Spanish TaskQueue:


_10
curl https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/TaskQueues \
_10
-d FriendlyName=SpanishDefault \
_10
-d TargetWorkers='(languages HAS "spanish")' \
_10
-d AssignmentActivitySid={ActivitySid}
_10
-d ReservationActivitySid={ActivitySid}
_10
-u {AccountSid}:{AuthToken}

Skills-based distribution models, where workers are assigned integer values reflecting their expertise in a given skill, are also possible. The TaskQueues created below use skills-based routing to choose the best worker based on a 'tech_support_skill' attribute:


_10
curl https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/TaskQueues \
_10
-d FriendlyName="Tech Support - Tier 1" \
_10
-d TargetWorkers="tech_support_skill < 5" \
_10
-d AssignmentActivitySid={ActivitySid}
_10
-d ReservationActivitySid={ActivitySid}
_10
-u {AccountSid}:{AuthToken}


_10
curl https://taskrouter.twilio.com/v1//Workspaces/{WorkspaceSid}/TaskQueues \
_10
-d FriendlyName="Tech Support - Escalation" \
_10
-d TargetWorkers="tech_support_skill > 5" \
_10
-d AssignmentActivitySid={ActivitySid}
_10
-d ReservationActivitySid={ActivitySid}
_10
-u {AccountSid}:{AuthToken}

To distribute tasks to any Worker, provide an expression that always evaluates to true:


_10
curl https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/TaskQueues \
_10
-d FriendlyName="Everyone" \
_10
-d TargetWorkers="1==1" \
_10
-u {AccountSid}:{AuthToken}
_10
TargetWorkers: Supported operators

Evaluating Worker Attributes

evaluating-worker-attributes page anchor

TaskQueue's list resource EvaluateWorkerAttributes parameter allows you to view which of your Workers will match a given TargetWorkers expression.

The example below is a way to check which TaskQueues would be mapped to a worker with attributes of tech_support_skill of 6. Using the above example, this should map to Tech Support - Escalation queue.


_10
curl -XGET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/TaskQueues \
_10
--data-urlencode EvaluateWorkerAttributes='{"tech_support_skill": "6"}'
_10
-u {AccountSid}:{AuthToken}

You may use the following operators in your TargetWorkers expressions:

  • Equality: == , =
  • Inequality: !=
  • Greater than: >
  • Less than: <
  • Greater than or equal to: >=
  • Less than or equal to: <=
  • Use parentheses to indicate precedence of operations: ( )
  • Use brackets to indicate lists/arrays: [ ]
  • HAS , >- for determining whether the value of the Worker attribute on the left-hand side of the expression contains the string on the right side of the comparison.
  • IN , <- for determining whether the value of the Worker attribute on the left-hand side of the expression is * contained in the list on the right-hand side.
  • AND if both the left and right subexpressions are true, resolves to true, otherwise false
  • OR - if one or both of the left or right subexpressions are true, resolves to true, otherwise false

A common request is the ability to create reservations for a set of workers in a given queue when a task comes in. You may configure a MaxReservedWorkers parameter on a queue to do just that. When a task routes to a particular queue through a workflow, TaskRouter will create reservations for all workers that are available up to the MaxReservedWorkers parameter. Once one worker accepts the reservation for the task, all other reservations will be rescinded. Any attempts to accept a rescinded reservation, the user will receive a 410 series response, indicating that the reservation can no longer accept the reservation of the task.

For example:

A Task becomes escalated to the "Tech Support - Escalation" TaskQueue, where there are 2 workers available and the MaxReservedWorkers parameter is configured to be 5. A Reservation will be created for each worker - 2 total. An Assignment Callback will be created for each Reservation. An Event Callback will be created for each Reservation creation.

Worker 1 accepts the reservation. Worker 2 will receive a notification that their Reservation is rescinded through the EventCallbackUrl and the JS SDK.


Retrieve a TaskQueue

action-get page anchor

_10
GET /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}

Return a single TaskQueue resource identified by {TaskQueueSid}.

Example for retrieving a single TaskQueue from a workspace

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
import twilio from "twilio";
_15
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = twilio(accountSid, authToken);
_15
_15
const taskQueue = await client.taskrouter.v1
_15
.workspaces("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_15
.taskQueues("WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_15
.fetch();
_15
_15
console.log(taskQueue.accountSid);

Output

_27
{
_27
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73",
_27
"assignment_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"date_created": "2015-08-04T01:31:41Z",
_27
"date_updated": "2015-08-04T01:31:41Z",
_27
"friendly_name": "81f96435-3a05-11e5-9f81-98e0d9a1eb73",
_27
"max_reserved_workers": 1,
_27
"links": {
_27
"assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",
_27
"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",
_27
"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",
_27
"list_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/Statistics",
_27
"bulk_real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/RealTimeStatistics"
_27
},
_27
"reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73",
_27
"reservation_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"target_workers": null,
_27
"task_order": "FIFO",
_27
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_27
}

A TaskQueue instance resource is represented by the following properties.

FieldDescription
SidThe unique ID of the TaskQueue
AccountSidThe ID of the Account that owns this TaskQueue
WorkspaceSidThe ID of the Workspace that owns this TaskQueue
FriendlyNameHuman readable description of the TaskQueue (for example "Customer Support" or "Sales")
TargetWorkersThe worker selection expressions associated with this TaskQueue.
ReservationActivitySidThe Activity to assign a Worker when they are reserved for a Task from this TaskQueue. Defaults to 'Reserved for Task'
AssignmentActivitySidThe Activity to assign a Worker when they accept a Task from this TaskQueue. Defaults to 'Unavailable for Assignment'.
MaxReservedWorkersThe maximum amount of workers to create reservations for the assignment of a task while in this queue.

Update a TaskQueue

action-update page anchor

_10
POST /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}

Modifies the TaskQueue. If you modify a TaskQueue and alter its TargetWorkers expression, the Worker statistics associated with this TaskQueue will be reset to reflect the new TargetWorkers. Task statistics for this TaskQueue will remain unchanged.

Example for updating TaskQueue

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
import twilio from "twilio";
_15
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = twilio(accountSid, authToken);
_15
_15
const taskQueue = await client.taskrouter.v1
_15
.workspaces("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_15
.taskQueues("WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_15
.update({ targetWorkers: 'languages HAS "english"' });
_15
_15
console.log(taskQueue.accountSid);

Output

_27
{
_27
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"assignment_activity_name": "817ca1c5-3a05-11e5-9292-98e0d9a1eb73",
_27
"assignment_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"date_created": "2015-08-04T01:31:41Z",
_27
"date_updated": "2015-08-04T01:31:41Z",
_27
"friendly_name": "81f96435-3a05-11e5-9f81-98e0d9a1eb73",
_27
"max_reserved_workers": 1,
_27
"links": {
_27
"assignment_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"reservation_activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",
_27
"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RealTimeStatistics",
_27
"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CumulativeStatistics",
_27
"list_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/Statistics",
_27
"bulk_real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/RealTimeStatistics"
_27
},
_27
"reservation_activity_name": "80fa2beb-3a05-11e5-8fc8-98e0d9a1eb73",
_27
"reservation_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"target_workers": "languages HAS \"english\"",
_27
"task_order": "FIFO",
_27
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_27
}

You may post the parameters below when modifying a TaskQueue.

ParameterDescription
FriendlyNameHuman readable description of this TaskQueue (for example "Support - Tier 1", "Sales" or "Escalation") (📇 PII )
TargetWorkersA string describing the Worker selection criteria for any Tasks that enter this TaskQueue. For example '"language" == "spanish"' If no TargetWorkers parameter is provided, Tasks will wait in this queue until they are either deleted or moved to another queue. Additional examples on how to describing Worker selection criteria below. (🏢 not PII )
ReservationActivitySidActivitySID that will be assigned to Workers when they are reserved for a task from this TaskQueue. (🏢 not PII )
AssignmentActivitySidActivitySID that will be assigned to Workers when they are assigned a task from this TaskQueue. (🏢 not PII )
MaxReservedWorkersThe maximum amount of workers to create reservations for the assignment of a task while in this queue. Maximum of 50. (🏢 not PII )
TaskOrderTaskOrder will determine which order the Tasks will be assigned to Workers. Set this parameter to LIFO to assign most recently created Task first or FIFO to assign the oldest Task. Default is FIFO. Click here to learn more. (🏢 not PII )

Delete a TaskQueue

action-delete page anchor

_10
DELETE /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}

Removes the TaskQueue identified by {TaskQueueSid}.

If associated Workflows' routing logic has recently been updated, pending Tasks may still be processing against this queue, in which case the response will be a 400.

Example for deleting a TaskQueue

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_13
// Download the helper library from https://www.twilio.com/docs/node/install
_13
import twilio from "twilio";
_13
_13
// Find your Account SID and Auth Token at twilio.com/console
_13
// and set the environment variables. See http://twil.io/secure
_13
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_13
const authToken = process.env.TWILIO_AUTH_TOKEN;
_13
const client = twilio(accountSid, authToken);
_13
_13
await client.taskrouter.v1
_13
.workspaces("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_13
.taskQueues("WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_13
.remove();


Rate this page: