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

The SID of the Account(link takes you to an external page) that created the Worker resource.

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

assigned_taskstype: integer

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


availabletype: boolean

Whether the Worker should receive Tasks of the TaskChannel type.


available_capacity_percentagetype: integer

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: integer

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>

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>

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>

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

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

task_channel_sidtype: SID<TC>

The SID of the TaskChannel.

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

task_channel_unique_nametype: string

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


worker_sidtype: SID<WK>

The SID of the Worker that contains the WorkerChannel.

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

workspace_sidtype: SID<WS>

The SID of the Workspace that contains the WorkerChannel.

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

urltype: string<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

Parameters

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

The SID of the Workspace with the WorkerChannel to fetch.

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

WorkerSidtype: SID<WK>
Path ParameterNot PII

The SID of the Worker with the WorkerChannel to fetch.

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

Sidtype: string
Path ParameterNot PII

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>
Path ParameterNot PII

The SID of the Workspace with the WorkerChannels to read.

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

WorkerSidtype: SID<WK>
Path ParameterNot PII

The SID of the Worker with the WorkerChannels to read.

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

PageSizetype: integer
Query ParameterNot PII

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

Minimum:
1

Pagetype: integer
Query ParameterNot PII

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

Minimum:
0

PageTokentype: string
Query ParameterNot PII

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>
Path ParameterNot PII

The SID of the Workspace with the WorkerChannel to update.

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

WorkerSidtype: SID<WK>
Path ParameterNot PII

The SID of the Worker with the WorkerChannel to update.

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

Sidtype: string
Path ParameterNot PII

The SID of the WorkerChannel to update.


Request body parameters
Capacitytype: integer

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: boolean

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: