Worker Reservation resource
Worker Reservations represent the current and past reservations for a Worker. Current Reservations can be accepted using the Reservation instance resource.
The SID of the Account that created the WorkerReservation resource.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
The current status of the reservation. Can be: pending, accepted, rejected, timeout, canceled, or rescinded.
pendingacceptedrejectedtimeoutcanceledrescindedwrappingcompletedThe unique string that we created to identify the WorkerReservation resource.
^WR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the reserved Task resource.
^WT[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the reserved Worker resource.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Workspace that this worker is contained within.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The URLs of related resources.
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations/{Sid}
The SID of the Workspace with the WorkerReservation resource to fetch.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the reserved Worker resource with the WorkerReservation resource to fetch.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the WorkerReservation resource to fetch.
^WR[0-9a-fA-F]{32}$Min length: 34Max length: 341// 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 fetchWorkerReservation() {11const reservation = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.reservations("WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.fetch();1617console.log(reservation.accountSid);18}1920fetchWorkerReservation();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2014-05-14T10:50:02Z",4"date_updated": "2014-05-15T16:03:42Z",5"links": {6"task": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9},10"reservation_status": "accepted",11"sid": "WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"task_sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"worker_name": "Doug",15"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"17}
GET https://taskrouter.twilio.com/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations
The SID of the Workspace with the WorkerReservation resources to read.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the reserved Worker resource with the WorkerReservation resources to read.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34Returns the list of reservations for a worker with a specified ReservationStatus. Can be: pending, accepted, rejected, timeout, canceled, or rescinded.
pendingacceptedrejectedtimeoutcanceledrescindedwrappingcompletedHow many resources to return in each list page. The default is 50, and the maximum is 1000.
1Maximum: 1000The 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 listWorkerReservation() {11const reservations = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.reservations.list({ limit: 20 });1516reservations.forEach((r) => console.log(r.accountSid));17}1819listWorkerReservation();
Response
1{2"meta": {3"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations?PageSize=50&Page=0",4"key": "reservations",5"next_page_url": null,6"page": 0,7"page_size": 50,8"previous_page_url": null,9"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations?PageSize=50&Page=0"10},11"reservations": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"date_created": "2014-05-14T10:50:02Z",15"date_updated": "2014-05-15T16:03:42Z",16"links": {17"task": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",19"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"20},21"reservation_status": "accepted",22"sid": "WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",23"task_sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"worker_name": "Doug",26"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"28}29]30}
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
Tasks are automatically canceled after 10 rejections. To learn more, see Manually accepting or rejecting a reservation
The If-Match HTTP request header
The SID of the Workspace with the WorkerReservation resources to update.
^WS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the reserved Worker resource with the WorkerReservation resources to update.
^WK[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the WorkerReservation resource to update.
^WR[0-9a-fA-F]{32}$Min length: 34Max length: 34application/x-www-form-urlencodedThe current status of the reservation. Can be: pending, accepted, rejected, timeout, canceled, or rescinded.
pendingacceptedrejectedtimeoutcanceledrescindedwrappingcompletedThe new worker activity SID if rejecting a reservation.
^WA[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Activity resource to start after executing a Dequeue instruction.
^WA[0-9a-fA-F]{32}$Min length: 34Max length: 34The caller ID of the call to the worker when executing a Dequeue instruction.
Whether to record both legs of a call when executing a Dequeue instruction or which leg to record.
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 formatted phone number, depending on the destination.
The callback URL for completed call event when executing a Dequeue instruction.
Whether to record both legs of a call when executing a Call instruction.
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 formatted phone number, depending on the destination.
TwiML URI executed on answering the worker's leg as a result of the Call instruction.
The URL to call for the completed call event when executing a Call instruction.
The Call SID of the call parked in the queue when executing a Redirect instruction.
^CA[0-9a-fA-F]{32}$Min length: 34Max length: 34Whether the reservation should be accepted when executing a Redirect instruction.
TwiML URI to redirect the call to when executing the Redirect instruction.
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 formatted phone number, depending on the destination.
The caller ID of the call to the worker when executing a Conference instruction.
The URL we should call using the status_callback_method to send status information to your application.
The HTTP method we should use to call status_callback. Can be: POST or GET and the default is POST.
GETPOSTThe call progress events that we will send to status_callback. Can be: initiated, ringing, answered, or completed.
initiatedringingansweredcompletedWhether to record the participant and their conferences, including the time between conferences. Can be true or false and the default is false.
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.
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.
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.
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.
GETPOSTWhether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is true.
The maximum number of participants allowed in the conference. Can be a positive integer from 2 to 250. The default value is 250.
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.
The HTTP method we should use to call conference_status_callback. Can be: GET or POST and defaults to POST.
GETPOSTThe conference status events that we will send to conference_status_callback. Can be: start, end, join, leave, mute, hold, speaker.
startendjoinleavemuteholdspeakerWhether 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.
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.
The recording channels for the final recording. Can be: mono or dual and the default is mono.
The URL that we should call using the recording_status_callback_method when the recording status changes.
The HTTP method we should use when we call recording_status_callback. Can be: GET or POST and defaults to POST.
GETPOSTThe URL we should call using the conference_recording_status_callback_method when the conference recording is available.
The HTTP method we should use to call conference_recording_status_callback. Can be: GET or POST and defaults to POST.
GETPOSTThe region where we should mix the recorded audio. Can be:us1, us2, ie1, de1, sg1, br1, au1, or jp1.
The call progress events sent via webhooks as a result of a Dequeue instruction.
The new worker activity SID after executing a Conference instruction.
^WA[0-9a-fA-F]{32}$Min length: 34Max length: 34Whether to end the conference when the customer leaves.
Whether to play a notification beep when the customer joins.
The jitter buffer size for conference. Can be: small, medium, large, off.
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 updateWorkerReservation() {11const reservation = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.reservations("WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.update({ reservationStatus: "accepted" });1617console.log(reservation.accountSid);18}1920updateWorkerReservation();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2014-05-14T10:50:02Z",4"date_updated": "2014-05-15T16:03:42Z",5"links": {6"task": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9},10"reservation_status": "accepted",11"sid": "WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"task_sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"worker_name": "Doug",15"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"17}
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 updateWorkerReservation() {11const reservation = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.reservations("WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.update({ reservationStatus: "rejected" });1617console.log(reservation.accountSid);18}1920updateWorkerReservation();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2014-05-14T10:50:02Z",4"date_updated": "2014-05-15T16:03:42Z",5"links": {6"task": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9},10"reservation_status": "rejected",11"sid": "WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"task_sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"worker_name": "Doug",15"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"17}
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 updateWorkerReservation() {11const reservation = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.reservations("WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.update({16dequeueFrom: "+18001231234",17instruction: "dequeue",18});1920console.log(reservation.accountSid);21}2223updateWorkerReservation();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2014-05-14T10:50:02Z",4"date_updated": "2014-05-15T16:03:42Z",5"links": {6"task": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9},10"reservation_status": "accepted",11"sid": "WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"task_sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"worker_name": "Doug",15"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"17}
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 updateWorkerReservation() {11const reservation = await client.taskrouter.v112.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.reservations("WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.update({16callAccept: true,17callFrom: "+15558675310",18callStatusCallbackUrl: "http://example.com/agent_answer_status_callback",19callUrl: "http://example.com/agent_answer",20instruction: "call",21});2223console.log(reservation.accountSid);24}2526updateWorkerReservation();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2014-05-14T10:50:02Z",4"date_updated": "2014-05-15T16:03:42Z",5"links": {6"task": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9},10"reservation_status": "accepted",11"sid": "WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"task_sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"worker_name": "Doug",15"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"17}