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
Resource properties
account_sidtype: SID<AC>Not PII

assigned_taskstype: integerNot PII

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


availabletype: booleanNot PII

Whether the Worker should receive Tasks of the TaskChannel type.


available_capacity_percentagetype: integerNot PII

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_capacitytype: integerNot PII

The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value.


date_createdtype: string<DATE TIME>Not PII

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


date_updatedtype: string<DATE TIME>Not PII

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


sidtype: SID<WC>Not PII

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


task_channel_sidtype: SID<TC>Not PII

The SID of the TaskChannel.


task_channel_unique_nametype: stringNot PII

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


worker_sidtype: SID<WK>Not PII

The SID of the Worker that contains the WorkerChannel.


workspace_sidtype: SID<WS>Not PII

The SID of the Workspace that contains the WorkerChannel.


urltype: string<URI>Not PII

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

Parameters

fetch-parameters page anchor
URI parameters
WorkspaceSidtype: SID<WS>Not PII
Path Parameter

The SID of the Workspace with the WorkerChannel to fetch.


WorkerSidtype: SID<WK>Not PII
Path Parameter

The SID of the Worker with the WorkerChannel to fetch.


Sidtype: stringNot PII
Path Parameter

The SID of the WorkerChannel to fetch.

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

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.workerChannels('WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.fetch()
_12
.then(worker_channel => console.log(worker_channel.taskChannelUniqueName));

Output

_15
{
_15
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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": "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"task_channel_sid": "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"task_channel_unique_name": "default",
_15
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_15
}


Read multiple WorkerChannel resources

read-multiple-workerchannel-resources page anchor
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels

URI parameters
WorkspaceSidtype: SID<WS>Not PII
Path Parameter

The SID of the Workspace with the WorkerChannels to read.


WorkerSidtype: SID<WK>Not PII
Path Parameter

The SID of the Worker with the WorkerChannels to read.


PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

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

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.workerChannels
_12
.list({limit: 20})
_12
.then(workerChannels => workerChannels.forEach(w => console.log(w.sid)));

Output

_28
{
_28
"meta": {
_28
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=0",
_28
"key": "channels",
_28
"next_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=1",
_28
"page": 0,
_28
"page_size": 50,
_28
"previous_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=0",
_28
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=0"
_28
},
_28
"channels": [
_28
{
_28
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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": "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_28
"task_channel_sid": "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_28
"task_channel_unique_name": "default",
_28
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_28
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_28
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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}

URI parameters
WorkspaceSidtype: SID<WS>Not PII
Path Parameter

The SID of the Workspace with the WorkerChannel to update.


WorkerSidtype: SID<WK>Not PII
Path Parameter

The SID of the Worker with the WorkerChannel to update.


Sidtype: stringNot PII
Path Parameter

The SID of the WorkerChannel to update.


Request body parameters
Capacitytype: integerNot PII

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.


Availabletype: booleanNot PII

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

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.workerChannels('WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.update({capacity: 1})
_12
.then(worker_channel => console.log(worker_channel.taskChannelUniqueName));

Output

_15
{
_15
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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": "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"task_channel_sid": "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"task_channel_unique_name": "default",
_15
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_15
}


Rate this page: