Worker Channel Resource
Worker Channels show the Worker's capacity for handling multiple concurrent Tasks. Workers receive Task reservation requests in parallel for each task type until the configured Task Channel capacity is reached. In addition, Worker Channels can also be marked as unavailable, which is useful for temporarily removing the capacity for a given Worker Channel and then restoring to the previous capacity when marking available again.
Property nameTypePIIDescription
The SID of the Account that created the Worker resource.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The total number of Tasks assigned to Worker for the TaskChannel type.
Whether the Worker should receive Tasks of the TaskChannel type.
available_capacity_percentageinteger The current percentage of capacity the TaskChannel has available. Can be a number between 0
and 100
. A value of 0
indicates that TaskChannel has no capacity available and a value of 100
means the Worker is available to receive any Tasks of this TaskChannel type.
configured_capacityinteger The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value.
date_createdstring<date-time>
date_updatedstring<date-time>
The unique string that we created to identify the WorkerChannel resource.
Pattern: ^WC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the TaskChannel.
Pattern: ^TC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
task_channel_unique_namestring The unique name of the TaskChannel, such as voice
or sms
.
The SID of the Worker that contains the WorkerChannel.
Pattern: ^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Workspace that contains the WorkerChannel.
Pattern: ^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The absolute URL of the WorkerChannel resource.
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}
Returns a single Worker Channel resource identified by either WorkerChannelUniqueName
or WorkerChannelSid
Property nameTypeRequiredPIIDescription
WorkspaceSidSID<WS>required The SID of the Workspace with the WorkerChannel to fetch.
Pattern: ^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker with the WorkerChannel to fetch.
Pattern: ^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the WorkerChannel to fetch.
_20// Download the helper library from https://www.twilio.com/docs/node/install
_20const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20// Find your Account SID and Auth Token at twilio.com/console
_20// and set the environment variables. See http://twil.io/secure
_20const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20const authToken = process.env.TWILIO_AUTH_TOKEN;
_20const client = twilio(accountSid, authToken);
_20async function fetchWorkerChannel() {
_20 const workerChannel = await client.taskrouter.v1
_20 .workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20 .workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20 .workerChannels("Sid")
_20 console.log(workerChannel.accountSid);
_15 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "available_capacity_percentage": 100,
_15 "configured_capacity": 1,
_15 "date_created": "2016-04-14T17:35:54Z",
_15 "date_updated": "2016-04-14T17:35:54Z",
_15 "task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "task_channel_unique_name": "default",
_15 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels
Property nameTypeRequiredPIIDescription
WorkspaceSidSID<WS>required The SID of the Workspace with the WorkerChannels to read.
Pattern: ^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker with the WorkerChannels to read.
Pattern: ^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Property nameTypeRequiredPIIDescription
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Minimum: 1
Maximum: 1000
The page index. This value is simply for client state.
Minimum: 0
The page token. This is provided by the API.
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function listWorkerChannel() {
_19 const workerChannels = await client.taskrouter.v1
_19 .workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .workerChannels.list({ limit: 20 });
_19 workerChannels.forEach((w) => console.log(w.accountSid));
_28 "first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0",
_28 "next_page_url": null,
_28 "previous_page_url": null,
_28 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0"
_28 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28 "available_capacity_percentage": 100,
_28 "configured_capacity": 1,
_28 "date_created": "2016-04-14T17:35:54Z",
_28 "date_updated": "2016-04-14T17:35:54Z",
_28 "sid": "WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28 "task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28 "task_channel_unique_name": "default",
_28 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28 "worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28 "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}
Property nameTypeRequiredPIIDescription
WorkspaceSidSID<WS>required The SID of the Workspace with the WorkerChannel to update.
Pattern: ^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker with the WorkerChannel to update.
Pattern: ^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the WorkerChannel to update.
Property nameTypeRequiredPIIDescription
The total number of Tasks that the Worker should handle for the TaskChannel type. TaskRouter creates reservations for Tasks of this TaskChannel type up to the specified capacity. If the capacity is 0, no new reservations will be created.
Whether the WorkerChannel is available. Set to false
to prevent the Worker from receiving any new Tasks of this TaskChannel type.
_20// Download the helper library from https://www.twilio.com/docs/node/install
_20const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20// Find your Account SID and Auth Token at twilio.com/console
_20// and set the environment variables. See http://twil.io/secure
_20const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20const authToken = process.env.TWILIO_AUTH_TOKEN;
_20const client = twilio(accountSid, authToken);
_20async function updateWorkerChannel() {
_20 const workerChannel = await client.taskrouter.v1
_20 .workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20 .workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20 .workerChannels("Sid")
_20 .update({ capacity: 351 });
_20 console.log(workerChannel.accountSid);
_20updateWorkerChannel();
_15 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "available_capacity_percentage": 100,
_15 "configured_capacity": 3,
_15 "date_created": "2016-04-14T17:35:54Z",
_15 "date_updated": "2016-04-14T17:35:54Z",
_15 "task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "task_channel_unique_name": "default",
_15 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15 "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"