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 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.
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.