Rate this page:

TaskRouter.js v1: Integrating TaskRouter to your browser-based applications

The following documentation is for the CDN version of TaskRouter JS SDK V1 and twilio-taskrouter-v1 on npm.

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.

Rate this page:

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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

Loading Code Sample...

        Thank you for your feedback!

        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!