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.
Worker attribute values do not support hyphens. Using a hyphen in a worker attribute value may cause a parsing error.
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:
1{2"skills": ["support", "sales"],3"languages":["english"]4}
The second worker, Bob, handles only Sales requests and speaks Spanish and English:
1{2"skills": ["sales"],3"languages": ["spanish", "english"]4}
A property of contact_uri
is required on the WorkerAttributes to indicate whom to call when issuing a Dequeue Instruction.
1{2"skills": ["sales"],3"languages": ["spanish", "english"],4"contact_uri": "client\:Bob"5}6
The Teams page uses the worker attribute team_sid
. If you have any custom implementations in Flex, do not use the same team_sid
worker attribute.
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.
The SID of the Account that created the Worker resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker's current Activity.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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.
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT of the last change to the Worker's activity specified in ISO 8601 format. Used to calculate Workflow statistics.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace.
The unique string that we created to identify the Worker resource.
^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Workspace that contains the Worker.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The URLs of related resources.
POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers
The SID of the Workspace that the new Worker belongs to.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
A descriptive string that you create to describe the new Worker. It can be up to 64 characters long.
The SID of a valid Activity that will describe the new Worker's initial state. See Activities for more information. If not provided, the new Worker's initial state is the default_activity_sid
configured on the Workspace.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 {}.
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 createWorker() {11const worker = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers.create({ friendlyName: "FriendlyName" });1415console.log(worker.accountSid);16}1718createWorker();
1{2"sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"friendly_name": "FriendlyName",4"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"activity_name": "Offline",7"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"attributes": "{}",9"available": false,10"date_created": "2017-05-30T23:19:38Z",11"date_updated": "2017-05-30T23:19:38Z",12"date_status_changed": "2017-05-30T23:19:38Z",13"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"consumed_concurrency": 0,15"consumed_attention": 0,16"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"links": {18"channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",19"activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/Statistics",22"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/RealTimeStatistics",23"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/CumulativeStatistics",24"worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",25"worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",26"reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations"27}28}
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}
The SID of the Workspace with the Worker to fetch.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker resource to fetch.
^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 fetchWorker() {11const worker = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.fetch();1516console.log(worker.accountSid);17}1819fetchWorker();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"activity_name": "available",4"activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"attributes": "{}",6"available": false,7"date_created": "2017-05-30T23:32:39Z",8"date_status_changed": "2017-05-30T23:32:39Z",9"date_updated": "2017-05-30T23:32:39Z",10"friendly_name": "NewWorker3",11"sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"consumed_concurrency": 0,14"consumed_attention": 0,15"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"links": {18"channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",19"activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/Statistics",22"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/RealTimeStatistics",23"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/CumulativeStatistics",24"worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",25"worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",26"reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations"27}28}
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.
The SID of the Workspace with the Workers to read.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The activity_sid
of the Worker resources to read.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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.
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
The friendly_name
of the TaskQueue that the Workers to read are eligible for.
The SID of the TaskQueue that the Workers to read are eligible for.
^WQ[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The 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 listWorker() {11const workers = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers.list({ limit: 20 });1415workers.forEach((w) => console.log(w.accountSid));16}1718listWorker();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&FriendlyName=friendly_name&PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&FriendlyName=friendly_name&PageSize=50&Page=0",8"next_page_url": null,9"key": "workers"10},11"workers": [12{13"sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"friendly_name": "testWorker",15"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"activity_name": "Offline",18"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",19"attributes": "{}",20"available": false,21"date_created": "2017-05-30T23:05:29Z",22"date_updated": "2017-05-30T23:05:29Z",23"date_status_changed": "2017-05-30T23:05:29Z",24"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"consumed_concurrency": 0,26"consumed_attention": 0,27"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"links": {29"channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",30"activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",31"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/Statistics",33"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/RealTimeStatistics",34"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/CumulativeStatistics",35"worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",36"worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",37"reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations"38}39}40]41}
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 listWorker() {11const workers = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers.list({14targetWorkersExpression: "name IN ['Alice','Bob','Connie','David']",15limit: 20,16});1718workers.forEach((w) => console.log(w.accountSid));19}2021listWorker();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&FriendlyName=friendly_name&PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&FriendlyName=friendly_name&PageSize=50&Page=0",8"next_page_url": null,9"key": "workers"10},11"workers": [12{13"sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"friendly_name": "testWorker",15"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"activity_name": "Offline",18"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",19"attributes": "{}",20"available": false,21"date_created": "2017-05-30T23:05:29Z",22"date_updated": "2017-05-30T23:05:29Z",23"date_status_changed": "2017-05-30T23:05:29Z",24"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"consumed_concurrency": 0,26"consumed_attention": 0,27"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"links": {29"channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",30"activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",31"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/Statistics",33"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/RealTimeStatistics",34"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/CumulativeStatistics",35"worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",36"worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",37"reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations"38}39}40]41}
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.
The If-Match HTTP request header
The SID of the Workspace with the Worker to update.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker resource to update.
^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
The SID of a valid Activity that will describe the Worker's initial state. See Activities for more information.
^WA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 {}.
A descriptive string that you create to describe the Worker. It can be up to 64 characters long.
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 updateWorker() {11const worker = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.update({ activitySid: "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });1516console.log(worker.accountSid);17}1819updateWorker();
1{2"sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"friendly_name": "blah",4"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"activity_name": "Offline",7"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"attributes": "{}",9"available": false,10"date_created": "2017-05-30T23:32:22Z",11"date_updated": "2017-05-31T00:05:57Z",12"date_status_changed": "2017-05-30T23:32:22Z",13"operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"consumed_concurrency": 0,15"consumed_attention": 0,16"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"links": {18"channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",19"activity": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/Statistics",22"real_time_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/RealTimeStatistics",23"cumulative_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/CumulativeStatistics",24"worker_statistics": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics",25"worker_channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",26"reservations": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations"27}28}
DELETE https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}
The If-Match HTTP request header
The SID of the Workspace with the Worker to delete.
^WS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Worker resource to delete.
^WK[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 deleteWorker() {11await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.remove();15}1617deleteWorker();
If you wish to view Reservations for a particular worker, use the Worker Reservation Resource.