This SDK is considered to be legacy and is not actively developed. For new integrations, we recommend you use the Twilio TaskRouter SDK v2 which supports both Flex and TaskRouter standalone deployments.
TaskRouter's JS library allows you to interact with the entire TaskRouter REST API by a simple JS API. TaskRouter supports the initialization of three types of objects:
Workers use a Websocket connection to TaskRouter to receive realtime notifications of Worker Reservations and Task details. Upon receiving a notification for a reservation, a Worker can accept or reject the reservation. In addition, a Worker can dequeue a given call that was enqueued using the Enqueue TwiML verb. Workers can be used to build a contact center agent desktop application, add Worker presence to your CRM system, leverage TaskRouter for internal support desk applications, and much more.
You can use Workspaces & TaskQueues to build an administrative panel of statistics and display your workers, tasks, and task queues.
Since the entire REST API is exposed with the JS SDK, any of these entities can modify their properties or their subresource properties. For example, worker can modify their current activity, attributes, and friendly name. A workspace can fetch a given task queue and update its TargetWorkers. A workspace can also fetch its statistics or for a given task queue.
Get started using TaskRouter.js with workers by working through the TaskRouter Quickstart or reviewing the TaskRouter JS Worker API documentation.
If you're working with the Twilio Flex, head over to the TaskRouter.js documentation on Github.