Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

TaskRouter.js v2 and v3: Integrating TaskRouter with your browser-based applications


TaskRouter SDK v2 and v3 are the current generations of the TaskRouter SDK, designed to offer enhanced interaction with the TaskRouter REST API.

TaskRouter SDK v2 uses a modern tech stack, which provides:

  • Faster response times
  • Better scalability to accommodate growing needs
  • Enhanced security measures
  • Seamless integrations
(information)

Upgrading to SDK v3

TaskRouter JS SDK 3.x requires Node.js 20 or later and removes the axios dependency. No API or code changes are required — v1, v2, and v3 all communicate with the same TaskRouter backend. To upgrade, update your twilio-taskrouter package to 3.x and ensure your environment runs Node.js 20 or later.

You can use TaskRouter SDK v2 with a standalone TaskRouter setup or the comprehensive capabilities of Flex. TaskRouter SDK v2 is designed to provide full functionality in either scenario.


Supported objects

supported-objects page anchor
  • Workspace: The foundational environment where all operations occur, including tasks, workers, and task queues.
  • Worker: Workers represent individual agents or resources. They can manage tasks, interact with supervisors, and handle transfer scenarios.
  • Transfers: This module manages incoming and outgoing transfers for smoother agent and task transitions.
  • TaskQueue: The holding area for tasks until they are assigned to workers.
  • Task: Individual units of work or assignments that workers handle. Tasks can be created, modified, or transitioned between states.
  • Supervisor: An added functionality that provides oversight of worker activities, tasks, and transfer scenarios, providing managerial control and intervention.
  • Reservation: This object allows for detailed tracking and management of reserved tasks for specific workers.
  • OutgoingTransfer: Specific object to manage tasks or communications being transferred out to other entities or channels.
  • IncomingTransfer: Tailored for tasks or communications incoming from different entities or channels, ensuring that they're queued or handled appropriately.
  • Channel: Represents various mediums or pathways through which tasks can arrive or be dispatched, such as voice, chat, or email.
  • Activity: Keeping track of the status or state of workers - be it available, busy, on break, or any custom states.

You can find the full TaskRouter SDK v2 reference in the TaskRouter.js documentation on GitHub(link takes you to an external page).