Worker Resource
Workers represent an entity that is able to perform tasks, such as an agent working in a call center, or a salesperson handling leads.
The default maximum number of registered Workers that can be created in the system is 15,000.
Warning Worker attribute values do not support hyphens. Using a hyphen in a worker attribute value may cause a parsing error.
Warning Pagination is not supported under this resource. Please avoid usage of the page
query parameter.
Worker Attributes
Every Worker has a set of Attributes that describe what sort of tasks the Worker is able to complete. Attributes are modeled as a JSON string and may contain string, integer, and array data. These attributes will be used to link a Worker to one or more TaskQueues, and thus determine which Tasks the Worker is eligible to handle.
For example, let's say we have two agents. The first worker, Alice, speaks English and handles Support and Sales Tasks:
_10 "skills": ["support", "sales"],
_10 "languages":["english"]
The second worker, Bob, handles only Sales requests and speaks Spanish and English:
_10 "languages": ["spanish", "english"]
Info A property of contact_uri
is required on the WorkerAttributes to indicate whom to call when issuing a Dequeue Instruction .
_10 "languages": ["spanish", "english"],
_10 "contact_uri": "client\:Bob"
Worker Activity
Each worker also has an Activity, represented by an ActivitySid. This Activity determines the worker's current state in the system, as well as whether the worker can accept new Task assignments.
Resource properties activity_name
type: string
The friendly_name
of the Worker's current Activity.
activity_sid
type: SID<WA>
The SID of the Worker's current Activity.
Pattern:
^WA[0-9a-fA-F]{32}$
attributes
type: string
The JSON string that describes the Worker. For example: { "email": "Bob@example.com", "phone": "+5095551234" }
. Note If this property has been assigned a value, it will only be displayed in FETCH actions that return a single resource. Otherwise, this property will be null, even if it has a value. This data is passed to the assignment_callback_url
when TaskRouter assigns a Task to the Worker.
available
type: boolean
Whether the Worker is available to perform tasks.
date_created
type: string<date-time>
date_status_changed
type: string<date-time>
date_updated
type: string<date-time>
friendly_name
type: string
The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace.
sid
type: SID<WK>
The unique string that we created to identify the Worker resource.
Pattern:
^WK[0-9a-fA-F]{32}$
workspace_sid
type: SID<WS>
The SID of the Workspace that contains the Worker.
Pattern:
^WS[0-9a-fA-F]{32}$
url
type: string<uri>
The absolute URL of the Worker resource.
links
type: object<uri-map>
The URLs of related resources.
POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers
URI parameters WorkspaceSid
type: SID<WS>
The SID of the Workspace that the new Worker belongs to.
Pattern:
^WS[0-9a-fA-F]{32}$
Request body parameters FriendlyName
type: string Required
A descriptive string that you create to describe the new Worker. It can be up to 64 characters long.
ActivitySid
type: SID<WA>
The SID of a valid Activity that will describe the new Worker's initial state. See Activities(link takes you to an external page) for more information. If not provided, the new Worker's initial state is the default_activity_sid
configured on the Workspace.
Pattern:
^WA[0-9a-fA-F]{32}$
Attributes
type: string
A valid JSON string that describes the new Worker. For example: { "email": "Bob@example.com", "phone": "+5095551234" }
. This data is passed to the assignment_callback_url
when TaskRouter assigns a Task to the Worker. Defaults to {}.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .create({friendlyName: 'friendly_name'})
_11 .then(worker => console.log(worker.sid));
_25 "sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "friendly_name": "NewWorker",
_25 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "activity_name": "Offline",
_25 "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "date_created": "2017-05-30T23:19:38Z",
_25 "date_updated": "2017-05-30T23:19:38Z",
_25 "date_status_changed": "2017-05-30T23:19:38Z",
_25 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_25 "activity": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Activities/WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/Statistics",
_25 "real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/RealTimeStatistics",
_25 "cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/CumulativeStatistics",
_25 "worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Statistics",
_25 "worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_25 "reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations"
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}
URI parameters WorkspaceSid
type: SID<WS>
The SID of the Workspace with the Worker to fetch.
Pattern:
^WS[0-9a-fA-F]{32}$
Sid
type: SID<WK>
The SID of the Worker resource to fetch.
Pattern:
^WK[0-9a-fA-F]{32}$
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(worker => console.log(worker.activityName));
_25 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "activity_name": "available",
_25 "activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "date_created": "2017-05-30T23:32:39Z",
_25 "date_status_changed": "2017-05-30T23:32:39Z",
_25 "date_updated": "2017-05-30T23:32:39Z",
_25 "friendly_name": "NewWorker3",
_25 "sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_25 "activity": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Activities/WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/Statistics",
_25 "real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/RealTimeStatistics",
_25 "cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/CumulativeStatistics",
_25 "worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Statistics",
_25 "worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_25 "reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations"
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers
By default, this will return the first 50 Workers. Supply a PageSize parameter to fetch more than 50 Workers. See pagination information for more information.
URI parameters WorkspaceSid
type: SID<WS>
The SID of the Workspace with the Workers to read.
Pattern:
^WS[0-9a-fA-F]{32}$
ActivityName
type: string
The activity_name
of the Worker resources to read.
ActivitySid
type: SID<WA>
The activity_sid
of the Worker resources to read.
Pattern:
^WA[0-9a-fA-F]{32}$
Available
type: string
Whether to return only Worker resources that are available or unavailable. Can be true
, 1
, or yes
to return Worker resources that are available, and false
, or any value returns the Worker resources that are not available.
FriendlyName
type: string
The friendly_name
of the Worker resources to read.
TargetWorkersExpression
type: string
Filter by Workers that would match an expression. In addition to fields in the workers' attributes, the expression can include the following worker fields: sid
, friendly_name
, activity_sid
, or activity_name
TaskQueueName
type: string
The friendly_name
of the TaskQueue that the Workers to read are eligible for.
TaskQueueSid
type: SID<WQ>
The SID of the TaskQueue that the Workers to read are eligible for.
Pattern:
^WQ[0-9a-fA-F]{32}$
Ordering
type: string
Sorting parameter for Workers
PageSize
type: integer
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Page
type: integer
The page index. This value is simply for client state.
PageToken
type: string
The page token. This is provided by the API.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(workers => workers.forEach(w => console.log(w.sid)));
_39 "first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=0",
_39 "previous_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=0",
_39 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=0",
_39 "next_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=1",
_39 "sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "friendly_name": "testWorker",
_39 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "activity_name": "Offline",
_39 "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "date_created": "2017-05-30T23:05:29Z",
_39 "date_updated": "2017-05-30T23:05:29Z",
_39 "date_status_changed": "2017-05-30T23:05:29Z",
_39 "operating_unit_sid": "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_39 "activity": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Activities/WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/Statistics",
_39 "real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/RealTimeStatistics",
_39 "cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/CumulativeStatistics",
_39 "worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Statistics",
_39 "worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_39 "reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations"
_14 // Download the helper library from https://www.twilio.com/docs/node/install
_14 // Find your Account SID and Auth Token at twilio.com/console
_14 // and set the environment variables. See http://twil.io/secure
_14 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14 const authToken = process.env.TWILIO_AUTH_TOKEN;
_14 const client = require('twilio')(accountSid, authToken);
_14 client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14 targetWorkersExpression: `name IN ['Alice','Bob','Connie','David']`,
_14 .then(workers => workers.forEach(w => console.log(w.sid)));
_39 "first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=0",
_39 "previous_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=0",
_39 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=0",
_39 "next_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&TaskQueueSid=WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&FriendlyName=friendly_name&PageSize=50&Page=1",
_39 "sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "friendly_name": "testWorker",
_39 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "activity_name": "Offline",
_39 "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "date_created": "2017-05-30T23:05:29Z",
_39 "date_updated": "2017-05-30T23:05:29Z",
_39 "date_status_changed": "2017-05-30T23:05:29Z",
_39 "operating_unit_sid": "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_39 "activity": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Activities/WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_39 "statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/Statistics",
_39 "real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/RealTimeStatistics",
_39 "cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/CumulativeStatistics",
_39 "worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Statistics",
_39 "worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_39 "reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations"
You can use the TargetWorkersExpression parameter to see which workers are matching the expression, or to understand why a certain queue isn't mapping to the workers you would expect.
This example checks which workers have a name attribute of Alice, Bob, Connie or David - and, by extension, if we had a queue that mapped to workers with those names, we can be confident that these workers would be associated with the queue.
POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}
Updating a Worker's current activity is a common operation in any TaskRouter application. You can do this using TaskRouter's Worker.js library , or using this REST API.
Request headers If-Match
type: string
The If-Match HTTP request header
URI parameters WorkspaceSid
type: SID<WS>
The SID of the Workspace with the Worker to update.
Pattern:
^WS[0-9a-fA-F]{32}$
Sid
type: SID<WK>
The SID of the Worker resource to update.
Pattern:
^WK[0-9a-fA-F]{32}$
Request body parameters Attributes
type: string
The JSON string that describes the Worker. For example: { "email": "Bob@example.com", "phone": "+5095551234" }
. This data is passed to the assignment_callback_url
when TaskRouter assigns a Task to the Worker. Defaults to {}.
FriendlyName
type: string
A descriptive string that you create to describe the Worker. It can be up to 64 characters long.
RejectPendingReservations
type: boolean
_13 // Download the helper library from https://www.twilio.com/docs/node/install
_13 // Find your Account SID and Auth Token at twilio.com/console
_13 // and set the environment variables. See http://twil.io/secure
_13 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_13 const authToken = process.env.TWILIO_AUTH_TOKEN;
_13 const client = require('twilio')(accountSid, authToken);
_13 client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_13 .workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_13 activitySid: 'WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
_13 .then(worker => console.log(worker.activityName));
_25 "sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "friendly_name": "blah",
_25 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "activity_sid": "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "activity_name": "Offline",
_25 "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "date_created": "2017-05-30T23:32:22Z",
_25 "date_updated": "2017-05-31T00:05:57Z",
_25 "date_status_changed": "2017-05-30T23:32:22Z",
_25 "url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_25 "activity": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Activities/WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25 "statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/Statistics",
_25 "real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/RealTimeStatistics",
_25 "cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/CumulativeStatistics",
_25 "worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Statistics",
_25 "worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels",
_25 "reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations"
DELETE https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}
Request headers If-Match
type: string
The If-Match HTTP request header
URI parameters WorkspaceSid
type: SID<WS>
The SID of the Workspace with the Worker to delete.
Pattern:
^WS[0-9a-fA-F]{32}$
Sid
type: SID<WK>
The SID of the Worker resource to delete.
Pattern:
^WK[0-9a-fA-F]{32}$
_10 // Download the helper library from https://www.twilio.com/docs/node/install
_10 // Find your Account SID and Auth Token at twilio.com/console
_10 // and set the environment variables. See http://twil.io/secure
_10 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10 const authToken = process.env.TWILIO_AUTH_TOKEN;
_10 const client = require('twilio')(accountSid, authToken);
_10 client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10 .workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')