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.
The SID of the Account that created the Worker resource.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The total number of Tasks assigned to Worker for the TaskChannel type.
0The 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.
0The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value.
0The date and time in GMT when the resource was created specified in RFC 2822 format.
The date and time in GMT when the resource was last updated specified in RFC 2822 format.
The unique string that we created to identify the WorkerChannel resource.
^WC[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the TaskChannel.
^TC[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Worker that contains the WorkerChannel.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Workspace that contains the WorkerChannel.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The 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
The SID of the Workspace with the WorkerChannel to fetch.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Worker with the WorkerChannel to fetch.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the WorkerChannel to fetch.
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 fetchWorkerChannel() {11const workerChannel = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.workerChannels("Sid")15.fetch();1617console.log(workerChannel.accountSid);18}1920fetchWorkerChannel();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"assigned_tasks": 0,4"available": true,5"available_capacity_percentage": 100,6"configured_capacity": 1,7"date_created": "2016-04-14T17:35:54Z",8"date_updated": "2016-04-14T17:35:54Z",9"sid": "Sid",10"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"task_channel_unique_name": "default",12"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"15}
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels
The SID of the Workspace with the WorkerChannels to read.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Worker with the WorkerChannels to read.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34How many resources to return in each list page. The default is 50, and the maximum is 1000.
1Maximum: 1000The 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 listWorkerChannel() {11const workerChannels = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.workerChannels.list({ limit: 20 });1516workerChannels.forEach((w) => console.log(w.accountSid));17}1819listWorkerChannel();
Response
1{2"meta": {3"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0",4"key": "channels",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/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0"10},11"channels": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"assigned_tasks": 0,15"available": true,16"available_capacity_percentage": 100,17"configured_capacity": 1,18"date_created": "2016-04-14T17:35:54Z",19"date_updated": "2016-04-14T17:35:54Z",20"sid": "WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",22"task_channel_unique_name": "default",23"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"26}27]28}
POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}
The SID of the Workspace with the WorkerChannel to update.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Worker with the WorkerChannel to update.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the WorkerChannel to update.
application/x-www-form-urlencodedThe 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.
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 updateWorkerChannel() {11const workerChannel = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.workerChannels("Sid")15.update({ capacity: 42 });1617console.log(workerChannel.accountSid);18}1920updateWorkerChannel();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"assigned_tasks": 0,4"available": true,5"available_capacity_percentage": 100,6"configured_capacity": 3,7"date_created": "2016-04-14T17:35:54Z",8"date_updated": "2016-04-14T17:35:54Z",9"sid": "Sid",10"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"task_channel_unique_name": "default",12"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"15}