Gathering detailed insights and metrics for twilio-taskrouter
Gathering detailed insights and metrics for twilio-taskrouter
Gathering detailed insights and metrics for twilio-taskrouter
Gathering detailed insights and metrics for twilio-taskrouter
JS SDK v2 for Twilio's TaskRouter skills based routing system.
npm install twilio-taskrouter
Typescript
Module System
Min. Node Version
JavaScript (97.23%)
TypeScript (2.24%)
Shell (0.5%)
Makefile (0.02%)
Dockerfile (0.01%)
CSS (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
27 Stars
736 Commits
37 Forks
19 Watchers
42 Branches
63 Contributors
Updated on May 15, 2025
Latest Version
2.1.0
Package Id
twilio-taskrouter@2.1.0
Unpacked Size
4.25 MB
Size
794.89 kB
File Count
71
Published on
May 15, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
11
1
36
TaskRouter is Twilio's skills based routing system. With this library, you can manage your Workers in the browser or view the state of your Workspace.
This version of TaskRouter SDK can be used with Twilio Flex and TaskRouter standalone instances.
npm install twilio-taskrouter
The following is a simple example showing a Worker waiting for Reservations. For more information, refer to the API Docs.
1const TaskRouter = require("twilio-taskrouter"); 2const Twilio = require("twilio"); 3const AccessToken = Twilio.jwt.AccessToken; 4const TaskRouterGrant = AccessToken.TaskRouterGrant; 5 6const accountSid = ""; 7const signingKeySid = ""; 8const signingKeySecret = ""; 9const workspaceSid = ""; 10const workerSid = ""; 11 12const token = createAccessToken( 13 accountSid, 14 signingKeySid, 15 signingKeySecret, 16 workspaceSid, 17 workerSid 18); 19const alice = new TaskRouter.Worker(token); 20 21alice.on("ready", (readyAlice) => { 22 console.log(`Worker ${readyAlice.sid} is now ready for work`); 23}); 24 25alice.on("reservationCreated", (reservation) => { 26 console.log( 27 `Reservation ${reservation.sid} has been created for ${alice.sid}` 28 ); 29 console.log(`Task attributes are: ${reservation.task.attributes}`); 30 31 reservation.on("accepted", (acceptedReservation) => { 32 console.log(`Reservation ${acceptedReservation.sid} was accepted.`); 33 }); 34 35 reservation 36 .accept() 37 .then((acceptedReservation) => { 38 console.log(`Reservation status is ${acceptedReservation.status}`); 39 }) 40 .catch((err) => { 41 console.log(`Error: ${err}`); 42 }); 43}); 44 45function createAccessToken( 46 accountSid, 47 signingKeySid, 48 signingKeySecret, 49 workspaceSid, 50 workerSid 51) { 52 const taskRouterGrant = new TaskRouterGrant({ 53 workerSid: workerSid, 54 workspaceSid: workspaceSid, 55 role: "worker", 56 }); 57 58 const accessToken = new AccessToken( 59 accountSid, 60 signingKeySid, 61 signingKeySecret 62 ); 63 accessToken.addGrant(taskRouterGrant); 64 accessToken.identity = "alice"; 65 66 return accessToken.toJwt(); 67}
See CHANGELOG.md.
See LICENSE.md.
Fork and clone the repository. Use npm to install node 8 (other versions may run into problems).
Then, install dependencies with:
yarn install
Then run the build
script:
yarn build
The builds and docs will be placed in the dist/
directory.
Before commits, be sure to validate by running:
make lint
Bug fixes welcome! If you're not familiar with the GitHub pull request/contribution process, this is a nice tutorial.
No vulnerabilities found.
Reason
12 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
30 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More