Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

REST API: Worker Channels

Workers Channels shows the Worker’s capacity for handling multiple concurrent tasks. Workers receive Task reservation requests in parallel for each task type until the configured Task Channel capacity is reached. In addition, Worker Channels can also be marked as unavailable, which is useful for temporarily removing the capacity for a given Worker Channel and then restoring to the previous capacity when marking available again.

Actions


List All Worker Channels

Resource URI

GET /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels

Returns the list of Task Channels in the workspace identified by {WorkspaceSid}.

Example

An example that lists all in a workspace

Loading Code Sample...
      
      
      
      

      Retrieve a Worker Channel

      Resource URI

      GET /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{WorkerChannelUniqueName}
      GET /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{WorkerChannelSid}
      

      Returns a single Worker Channel resource identified by either {WorkerChannelUniqueName} or {WorkerChannelSid}

      Example

      Example of retrieving a single Worker Channel

      Loading Code Sample...
          
          
          
          

          Resource Properties

          Field Description
          Sid The unique ID for this Worker Channel.
          AccountSid The unique ID of the Account that owns this Worker Channel.
          WorkspaceSid The unique ID of the Workspace that this Worker Channel belongs to.
          WorkerSid The unique ID of the Worker that this Worker Channel belongs to.
          TaskChannelSid The unique ID of the TaskChannel.
          TaskChannelUniqueName The unique name of TaskChannel, such as 'voice', 'sms', etc.
          ConfiguredCapacity The current configured capacity for the Worker Channel. TaskRouter will not create any reservations once assigned Tasks for the worker reaches the value configured here.
          Available Boolean value indicating whether the worker should receive Tasks of this TaskChannel type. Set this to False to stop worker from receiving Tasks of this TaskChannel type.
          AssignedTasks The total number of tasks assigned to Worker for this TaskChannel type.
          AvailableCapacityPercentage The current available capacity between 0 to 100 for this TaskChannel. If the value returned is 100, that means Worker is available to receive any Tasks of this TaskChannel type.
          DateCreated The date this Activity was created.
          DateUpdated The date this Activity was updated.

          Update a Worker Channel

          Resource URI

          POST /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{WorkerChannelUniqueName}
          POST /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{WorkerChannelSid}
          

          Updates a Worker Channel instance identified by either {WorkerChannelUniqueName} or {WorkerChannelSid}

          Example

          Example for updating capacity for 'voice' channel.

          Loading Code Sample...
              
              
              
              

              POST Parameters

              You may use the following parameters when modifying a Worker Channel.

              Field Description
              Capacity The total number of Tasks worker should handle for this TaskChannel type. TaskRouter will only create reservations for Tasks of this TaskChannel type up to the capacity configured. If the capacity is 0, no new reservations will be created (🏢 not PII )
              Available Toggle the availability of the Worker Channel. Set this to 'False' to make worker unavailable to receive any new Tasks of this TaskChannel type. (🏢 not PII )

              Need some help?

              We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

              Loading Code Sample...