NAME

Twilio::Rest::Taskrouter::V1::Workspace::Worker - The Worker resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $worker = $client->taskrouter->v1->workspaces($workspace_sid)->workers->create($friendly_name, \%options);
for my $worker ($client->taskrouter->v1->workspaces($workspace_sid)->workers->read({}, 20)) {
  ...
}
my $worker = $client->taskrouter->v1->workspaces($workspace_sid)->workers($sid)->fetch;
$client->taskrouter->v1->workspaces($workspace_sid)->workers($sid)->update(\%options);
$client->taskrouter->v1->workspaces($workspace_sid)->workers($sid)->delete;

DESCRIPTION

This file holds WorkerList, WorkerPage, WorkerContext and WorkerInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

WorkerList

Returned by $client->taskrouter->v1->workspaces($workspace_sid)->workers. See also Twilio::ListResource.

create

my $worker = $client->taskrouter->v1->workspaces($workspace_sid)->workers->create($friendly_name, \%options);

Returns a WorkerInstance.

The required values are:

$friendly_name

A descriptive string that you create to describe the new Worker. It can be up to 64 characters long.

The options are:

activity_sid

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.

attributes

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 {}.

read

my @records = $client->taskrouter->v1->workspaces($workspace_sid)->workers->read(\%options, $limit, $page_size);

Returns the records as a list, fetching as many pages as it needs.

The options are:

activity_name

The activity_name of the Worker resources to read.

activity_sid

The activity_sid of the Worker resources to read.

available

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.

friendly_name

The friendly_name of the Worker resources to read.

ordering

Sorting parameter for Workers

target_workers_expression

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

task_queue_name

The friendly_name of the TaskQueue that the Workers to read are eligible for.

task_queue_sid

The SID of the TaskQueue that the Workers to read are eligible for.

stream

my $stream = $client->taskrouter->v1->workspaces($workspace_sid)->workers->stream(\%options, $limit, $page_size);

Takes the same arguments as "read", and returns a Twilio::Stream.

page

my $page = $client->taskrouter->v1->workspaces($workspace_sid)->workers->page(\%options, $page_size, $page_token, $page_number);

Fetches one page, and returns a Twilio::Page.

get_page

my $page = $client->taskrouter->v1->workspaces($workspace_sid)->workers->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->taskrouter->v1->workspaces($workspace_sid)->workers->get_context($sid);

Returns a WorkerContext, and makes no request.

statistics

my $context = $object->statistics;

See Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersStatistics.

WorkerPage

A Twilio::Page of WorkerInstance objects.

records_key

build_instance

Used by Twilio::Page.

WorkerContext

Returned by $client->taskrouter->v1->workspaces($workspace_sid)->workers($sid). It makes no request until one of these methods is called.

fetch

my $worker = $client->taskrouter->v1->workspaces($workspace_sid)->workers($sid)->fetch;

Returns a WorkerInstance.

update

my $worker = $client->taskrouter->v1->workspaces($workspace_sid)->workers($sid)->update(\%options);

Returns a WorkerInstance.

The options are:

activity_sid

The SID of a valid Activity that will describe the Worker's initial state. See Activities for more information.

attributes

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 {}.

friendly_name

A descriptive string that you create to describe the Worker. It can be up to 64 characters long.

reject_pending_reservations

Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new Activity resource has its availability property set to False.

if_match

The If-Match HTTP request header

delete

$client->taskrouter->v1->workspaces($workspace_sid)->workers($sid)->delete(\%options);

Returns true.

The options are:

if_match

The If-Match HTTP request header

reservations

my $list = $object->reservations;

my $context = $object->reservations($sid);

See Twilio::Rest::Taskrouter::V1::Workspace::Worker::Reservation.

worker_channels

my $list = $object->worker_channels;

my $context = $object->worker_channels($sid);

See Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkerChannel.

statistics

my $context = $object->statistics;

See Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkerStatistics.

cumulative_statistics

my $context = $object->cumulative_statistics;

See Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersCumulativeStatistics.

real_time_statistics

my $context = $object->real_time_statistics;

See Twilio::Rest::Taskrouter::V1::Workspace::Worker::WorkersRealTimeStatistics.

WorkerInstance

See also Twilio::InstanceResource.

It has fetch, update, delete, reservations, worker_channels, statistics, cumulative_statistics and real_time_statistics, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account that created the Worker resource.

activity_name

The friendly_name of the Worker's current Activity.

activity_sid

The SID of the Worker's current Activity.

attributes

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

Whether the Worker is available to perform tasks.

date_created

The date and time in GMT when the resource was created specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_status_changed

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. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when the resource was last updated specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

friendly_name

The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace.

The URLs of related resources.

sid

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

url

The absolute URL of the Worker resource.

workspace_sid

The SID of the Workspace that contains the Worker.

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.