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

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.


WorkerChannel Properties

workerchannel-properties page anchor
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The SID of the Account that created the Worker resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

assigned_tasksinteger

The total number of Tasks assigned to Worker for the TaskChannel type.


availableboolean

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_updatedstring<date-time>

The date and time in GMT when the resource was last updated specified in RFC 2822(link takes you to an external page) format.


sidSID<WC>

The unique string that we created to identify the WorkerChannel resource.

Pattern: ^WC[0-9a-fA-F]{32}$Min length: 34Max length: 34

task_channel_sidSID<TC>

The SID of the TaskChannel.

Pattern: ^TC[0-9a-fA-F]{32}$Min length: 34Max length: 34

task_channel_unique_namestring

The unique name of the TaskChannel, such as voice or sms.


worker_sidSID<WK>

The SID of the Worker that contains the WorkerChannel.

Pattern: ^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34

workspace_sidSID<WS>

The SID of the Workspace that contains the WorkerChannel.

Pattern: ^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34

urlstring<uri>

The absolute URL of the WorkerChannel resource.


Fetch a WorkerChannel resource

fetch-a-workerchannel-resource page anchor
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}

Returns a single Worker Channel resource identified by either WorkerChannelUniqueName or WorkerChannelSid

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
WorkspaceSidSID<WS>required

The SID of the Workspace with the WorkerChannel to fetch.

Pattern: ^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34

WorkerSidSID<WK>required

The SID of the Worker with the WorkerChannel to fetch.

Pattern: ^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34

Sidstringrequired

The SID of the WorkerChannel to fetch.

Fetch a WorkerChannel

fetch-a-workerchannel page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function fetchWorkerChannel() {
_20
const workerChannel = await client.taskrouter.v1
_20
.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.workerChannels("Sid")
_20
.fetch();
_20
_20
console.log(workerChannel.accountSid);
_20
}
_20
_20
fetchWorkerChannel();

Output

_15
{
_15
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"assigned_tasks": 0,
_15
"available": true,
_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
"sid": "Sid",
_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"
_15
}


Read multiple WorkerChannel resources

read-multiple-workerchannel-resources page anchor
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: 34Max length: 34

WorkerSidSID<WK>required

The SID of the Worker with the WorkerChannels to read.

Pattern: ^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

List multiple WorkerChannels

list-multiple-workerchannels page anchor
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
const twilio = require("twilio"); // Or, for ESM: 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
async function listWorkerChannel() {
_19
const workerChannels = await client.taskrouter.v1
_19
.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.workerChannels.list({ limit: 20 });
_19
_19
workerChannels.forEach((w) => console.log(w.accountSid));
_19
}
_19
_19
listWorkerChannel();

Output

_28
{
_28
"meta": {
_28
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0",
_28
"key": "channels",
_28
"next_page_url": null,
_28
"page": 0,
_28
"page_size": 50,
_28
"previous_page_url": null,
_28
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0"
_28
},
_28
"channels": [
_28
{
_28
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"assigned_tasks": 0,
_28
"available": true,
_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"
_28
}
_28
]
_28
}


Update a WorkerChannel resource

update-a-workerchannel-resource page anchor
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: 34Max length: 34

WorkerSidSID<WK>required

The SID of the Worker with the WorkerChannel to update.

Pattern: ^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34

Sidstringrequired

The SID of the WorkerChannel to update.

Property nameTypeRequiredPIIDescription
CapacityintegerOptional

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.


AvailablebooleanOptional

Whether the WorkerChannel is available. Set to false to prevent the Worker from receiving any new Tasks of this TaskChannel type.

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

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function updateWorkerChannel() {
_20
const workerChannel = await client.taskrouter.v1
_20
.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.workerChannels("Sid")
_20
.update({ capacity: 351 });
_20
_20
console.log(workerChannel.accountSid);
_20
}
_20
_20
updateWorkerChannel();

Output

_15
{
_15
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"assigned_tasks": 0,
_15
"available": true,
_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
"sid": "Sid",
_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"
_15
}


Rate this page: