Rate this page:

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

The following documentation is for the v1 of the JS SDK. To learn more about the SDK being used in Twilio Flex, head over to the TaskRouter.js documentation on Github.

TaskRouter's JS library allows you 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.

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 Community Forums or browsing the Twilio tag on Stack Overflow.


        Thank you for your feedback!

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

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

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more