Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Worker Reservation Resource


Worker Reservations represent the current and past reservations for a Worker. Current Reservations can be accepted using the Reservation instance resource.


WorkerReservation Properties

workerreservation-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 WorkerReservation resource.

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

date_createdtype: string<date-time>

The date and time in GMT when the resource was created specified in ISO 8601(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 ISO 8601(link takes you to an external page) format.


reservation_statustype: enum<string>

The current status of the reservation. Can be: pending, accepted, rejected, timeout, canceled, or rescinded.

Possible values:
pendingacceptedrejectedtimeoutcanceledrescindedwrappingcompleted

sidtype: SID<WR>

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

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

task_sidtype: SID<WT>

The SID of the reserved Task resource.

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

worker_nametype: string

The friendly_name of the Worker that is reserved.


worker_sidtype: SID<WK>

The SID of the reserved Worker resource.

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

workspace_sidtype: SID<WS>

The SID of the Workspace that this worker is contained within.

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

urltype: string<uri>

The absolute URL of the WorkerReservation resource.


linkstype: object<uri-map>

The URLs of related resources.


Fetch a WorkerReservation resource

fetch-a-workerreservation-resource page anchor
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations/{Sid}

Parameters

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

The SID of the Workspace with the WorkerReservation resource 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 reserved Worker resource with the WorkerReservation resource to fetch.

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

Sidtype: SID<WR>
Path ParameterNot PII

The SID of the WorkerReservation resource to fetch.

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

Fetch a WorkerReservation

fetch-a-workerreservation 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
.reservations('WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.fetch()
_12
.then(reservation => console.log(reservation.workerName));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2014-05-14T10:50:02Z",
_17
"date_updated": "2014-05-15T16:03:42Z",
_17
"links": {
_17
"task": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
},
_17
"reservation_status": "accepted",
_17
"sid": "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations/WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker_name": "Doug",
_17
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}


Read multiple WorkerReservation resources

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

URI parameters
WorkspaceSidtype: SID<WS>
Path ParameterNot PII

The SID of the Workspace with the WorkerReservation resources 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 reserved Worker resource with the WorkerReservation resources to read.

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

ReservationStatustype: enum<string>
Query ParameterNot PII

Returns the list of reservations for a worker with a specified ReservationStatus. Can be: pending, accepted, rejected, timeout, canceled, or rescinded.

Possible values:
pendingacceptedrejectedtimeoutcanceledrescindedwrappingcompleted

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 WorkerReservations

list-multiple-workerreservations 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
.reservations
_12
.list({limit: 20})
_12
.then(reservations => reservations.forEach(r => console.log(r.sid)));

Output

_30
{
_30
"meta": {
_30
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations?PageSize=50&Page=0",
_30
"key": "reservations",
_30
"next_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations?PageSize=50&Page=1",
_30
"page": 0,
_30
"page_size": 50,
_30
"previous_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations?PageSize=50&Page=0",
_30
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations?PageSize=50&Page=0"
_30
},
_30
"reservations": [
_30
{
_30
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"date_created": "2014-05-14T10:50:02Z",
_30
"date_updated": "2014-05-15T16:03:42Z",
_30
"links": {
_30
"task": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_30
},
_30
"reservation_status": "accepted",
_30
"sid": "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations/WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"worker_name": "Doug",
_30
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_30
}
_30
]
_30
}


Update a WorkerReservation resource

update-a-workerreservation-resource page anchor
POST https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations/{Sid}

To indicate that a Worker has accepted or rejected a Reservation, you make an HTTP POST request to a Reservation instance resource URI.

You can issue a simple Accept or Reject request. You can also issue an Instruction, like Dequeueing or Calling, similar to Responding to an Assignment Callback.

(warning)

Warning

Tasks are automatically canceled after 10 rejections.

See Manually accepting or rejecting a reservation for more information.

Request headers
If-Matchtype: string

The If-Match HTTP request header


URI parameters
WorkspaceSidtype: SID<WS>
Path ParameterNot PII

The SID of the Workspace with the WorkerReservation resources 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 reserved Worker resource with the WorkerReservation resources to update.

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

Sidtype: SID<WR>
Path ParameterNot PII

The SID of the WorkerReservation resource to update.

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

Request body parameters
ReservationStatustype: enum<string>

The new status of the reservation. Can be: pending, accepted, rejected, timeout, canceled, or rescinded.

Possible values:
pendingacceptedrejectedtimeoutcanceledrescindedwrappingcompleted

WorkerActivitySidtype: SID<WA>

The new worker activity SID if rejecting a reservation.

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

Instructiontype: string

The assignment instruction for the reservation.


DequeuePostWorkActivitySidtype: SID<WA>

The SID of the Activity resource to start after executing a Dequeue instruction.

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

DequeueFromtype: string

The caller ID of the call to the worker when executing a Dequeue instruction.


DequeueRecordtype: string

Whether to record both legs of a call when executing a Dequeue instruction or which leg to record.


DequeueTimeouttype: integer

The timeout for call when executing a Dequeue instruction.


DequeueTotype: string

The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the E.164(link takes you to an external page) formatted phone number, depending on the destination.


DequeueStatusCallbackUrltype: string<uri>

The callback URL for completed call event when executing a Dequeue instruction.


CallFromtype: string

The Caller ID of the outbound call when executing a Call instruction.


CallRecordtype: string

Whether to record both legs of a call when executing a Call instruction.


CallTimeouttype: integer

The timeout for a call when executing a Call instruction.


CallTotype: string

The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the E.164(link takes you to an external page) formatted phone number, depending on the destination.


CallUrltype: string<uri>

TwiML URI executed on answering the worker's leg as a result of the Call instruction.


CallStatusCallbackUrltype: string<uri>

The URL to call for the completed call event when executing a Call instruction.


CallAccepttype: boolean

Whether to accept a reservation when executing a Call instruction.


RedirectCallSidtype: SID<CA>

The Call SID of the call parked in the queue when executing a Redirect instruction.

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

RedirectAccepttype: boolean

Whether the reservation should be accepted when executing a Redirect instruction.


RedirectUrltype: string<uri>

TwiML URI to redirect the call to when executing the Redirect instruction.


Totype: string

The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the E.164(link takes you to an external page) formatted phone number, depending on the destination.


Fromtype: string

The caller ID of the call to the worker when executing a Conference instruction.


StatusCallbacktype: string<uri>

The URL we should call using the status_callback_method to send status information to your application.


StatusCallbackMethodtype: enum<http-method>

The HTTP method we should use to call status_callback. Can be: POST or GET and the default is POST.

Possible values:
GETPOST

StatusCallbackEventtype: array[string]

The call progress events that we will send to status_callback. Can be: initiated, ringing, answered, or completed.

Possible values:
initiatedringingansweredcompleted

Timeouttype: integer

The timeout for a call when executing a Conference instruction.


Recordtype: boolean

Whether to record the participant and their conferences, including the time between conferences. Can be true or false and the default is false.


Mutedtype: boolean

Whether the agent is muted in the conference. Defaults to false.


Beeptype: string

Whether to play a notification beep when the participant joins or when to play a beep. Can be: true, false, onEnter, or onExit. The default value is true.


StartConferenceOnEntertype: boolean

Whether to start the conference when the participant joins, if it has not already started. Can be: true or false and the default is true. If false and the conference has not started, the participant is muted and hears background music until another participant starts the conference.


EndConferenceOnExittype: boolean

Whether to end the conference when the agent leaves.


WaitUrltype: string<uri>

The URL we should call using the wait_method for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. Learn more about hold music(link takes you to an external page).


WaitMethodtype: enum<http-method>

The HTTP method we should use to call wait_url. Can be GET or POST and the default is POST. When using a static audio file, this should be GET so that we can cache the file.

Possible values:
GETPOST

EarlyMediatype: boolean

Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is true.


MaxParticipantstype: integer

The maximum number of participants allowed in the conference. Can be a positive integer from 2 to 250. The default value is 250.


ConferenceStatusCallbacktype: string<uri>

The URL we should call using the conference_status_callback_method when the conference events in conference_status_callback_event occur. Only the value set by the first participant to join the conference is used. Subsequent conference_status_callback values are ignored.


ConferenceStatusCallbackMethodtype: enum<http-method>

The HTTP method we should use to call conference_status_callback. Can be: GET or POST and defaults to POST.

Possible values:
GETPOST

ConferenceStatusCallbackEventtype: array[string]

The conference status events that we will send to conference_status_callback. Can be: start, end, join, leave, mute, hold, speaker.

Possible values:
startendjoinleavemuteholdspeaker

ConferenceRecordtype: string

Whether to record the conference the participant is joining or when to record the conference. Can be: true, false, record-from-start, and do-not-record. The default value is false.


ConferenceTrimtype: string

Whether to trim leading and trailing silence from your recorded conference audio files. Can be: trim-silence or do-not-trim and defaults to trim-silence.


RecordingChannelstype: string

The recording channels for the final recording. Can be: mono or dual and the default is mono.


RecordingStatusCallbacktype: string<uri>

The URL that we should call using the recording_status_callback_method when the recording status changes.


RecordingStatusCallbackMethodtype: enum<http-method>

The HTTP method we should use when we call recording_status_callback. Can be: GET or POST and defaults to POST.

Possible values:
GETPOST

ConferenceRecordingStatusCallbacktype: string<uri>

The URL we should call using the conference_recording_status_callback_method when the conference recording is available.


ConferenceRecordingStatusCallbackMethodtype: enum<http-method>

The HTTP method we should use to call conference_recording_status_callback. Can be: GET or POST and defaults to POST.

Possible values:
GETPOST

Regiontype: string

The region(link takes you to an external page) where we should mix the recorded audio. Can be:us1, ie1, de1, sg1, br1, au1, or jp1.


SipAuthUsernametype: string

The SIP username used for authentication.


SipAuthPasswordtype: string

The SIP password for authentication.


DequeueStatusCallbackEventtype: array[string]

The call progress events sent via webhooks as a result of a Dequeue instruction.


PostWorkActivitySidtype: SID<WA>

The new worker activity SID after executing a Conference instruction.

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

EndConferenceOnCustomerExittype: boolean

Whether to end the conference when the customer leaves.


BeepOnCustomerEntrancetype: boolean

Whether to play a notification beep when the customer joins.


JitterBufferSizetype: string

The jitter buffer size for conference. Can be: small, medium, large, off.

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
.reservations('WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.update({reservationStatus: 'accepted'})
_12
.then(reservation => console.log(reservation.workerName));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2014-05-14T10:50:02Z",
_17
"date_updated": "2014-05-15T16:03:42Z",
_17
"links": {
_17
"task": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
},
_17
"reservation_status": "accepted",
_17
"sid": "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations/WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker_name": "Doug",
_17
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}

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
.reservations('WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.update({reservationStatus: 'rejected'})
_12
.then(reservation => console.log(reservation.workerName));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2014-05-14T10:50:02Z",
_17
"date_updated": "2014-05-15T16:03:42Z",
_17
"links": {
_17
"task": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
},
_17
"reservation_status": "rejected",
_17
"sid": "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations/WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker_name": "Doug",
_17
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}

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

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = require('twilio')(accountSid, authToken);
_15
_15
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_15
.workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_15
.reservations('WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_15
.update({
_15
instruction: 'dequeue',
_15
dequeueFrom: '+18001231234'
_15
})
_15
.then(reservation => console.log(reservation.workerName));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2014-05-14T10:50:02Z",
_17
"date_updated": "2014-05-15T16:03:42Z",
_17
"links": {
_17
"task": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
},
_17
"reservation_status": "accepted",
_17
"sid": "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations/WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker_name": "Doug",
_17
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}

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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = require('twilio')(accountSid, authToken);
_18
_18
client.taskrouter.v1.workspaces('WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_18
.workers('WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_18
.reservations('WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_18
.update({
_18
instruction: 'call',
_18
callFrom: '+15558675310',
_18
callUrl: 'http://example.com/agent_answer',
_18
callStatusCallbackUrl: 'http://example.com/agent_answer_status_callback',
_18
callAccept: true
_18
})
_18
.then(reservation => console.log(reservation.workerName));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2014-05-14T10:50:02Z",
_17
"date_updated": "2014-05-15T16:03:42Z",
_17
"links": {
_17
"task": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Tasks/WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
},
_17
"reservation_status": "accepted",
_17
"sid": "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Workers/WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Reservations/WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"worker_name": "Doug",
_17
"worker_sid": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}


Rate this page: