All Projects → twilio → twilio-taskrouter.js

twilio / twilio-taskrouter.js

Licence: other
JS SDK v2 for Twilio's TaskRouter skills based routing system.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to twilio-taskrouter.js

somleng
Open Source Implementation of Twilio's REST API
Stars: ✭ 33 (+65%)
Mutual labels:  twilio, twilio-api
flex-plugin-builder
Packages related to building a Twilio Flex Plugin
Stars: ✭ 69 (+245%)
Mutual labels:  twilio, twilio-flex
ruby-whatsapp-bots
A repo of WhatsApp bots built in Ruby
Stars: ✭ 18 (-10%)
Mutual labels:  twilio, twilio-api
twiliolo
Golang API wrapper for Twilio API [WIP]
Stars: ✭ 25 (+25%)
Mutual labels:  twilio, twilio-api
twilio-taskrouter-realtime-dashboard
Twilio TaskRouter Realtime Dashboard using Sync
Stars: ✭ 51 (+155%)
Mutual labels:  twilio, taskrouter
Twilio Python
A Python module for communicating with the Twilio API and generating TwiML.
Stars: ✭ 1,536 (+7580%)
Mutual labels:  twilio, twilio-api
quarantine-bot
WhatsApp bot powered by Twilio API to get through the quarantine. Latest COVID19 statistics, world news, inspirational quotes and cat photos.
Stars: ✭ 24 (+20%)
Mutual labels:  twilio, twilio-api
wireless-portable-fax
Build a cellular connected portable fax machine
Stars: ✭ 17 (-15%)
Mutual labels:  twilio, twilio-api
PySMS
Simple Python API that that allows you to send texts via SMTP with a best effort approach and process replies via IMAP
Stars: ✭ 19 (-5%)
Mutual labels:  twilio
hackathons
A collection of tips and tricks for using Twilio at hackathons
Stars: ✭ 35 (+75%)
Mutual labels:  twilio
apostello
sms for your church
Stars: ✭ 62 (+210%)
Mutual labels:  twilio
VaporTwilioService
Twilio API provider for all your Vapor needs
Stars: ✭ 19 (-5%)
Mutual labels:  twilio
sms blitz
Send SMS messages through multiple different providers
Stars: ✭ 29 (+45%)
Mutual labels:  twilio
WhatsAppBotTut
Tutorial to create WhatsApp Bot using Twilio and Python
Stars: ✭ 131 (+555%)
Mutual labels:  twilio
IEvangelist.VideoChat
Imagine two Twilio SDKs, ASP.NET Core/C#, Angular/TypeScript, SignalR, etc... Yeah, amazing!
Stars: ✭ 66 (+230%)
Mutual labels:  twilio
plivo
This package enables to send message or OTP to any mobile.This package uses external plivo api.
Stars: ✭ 20 (+0%)
Mutual labels:  twilio
sms-bot
an SMS bot built with Google sheets and Twilio
Stars: ✭ 61 (+205%)
Mutual labels:  twilio
poseparty
A social exercise game you can play while social distancing.
Stars: ✭ 25 (+25%)
Mutual labels:  twilio
appointment-reminders-rails
A working Appointment Reminders sample built in Ruby on Rails
Stars: ✭ 36 (+80%)
Mutual labels:  twilio
useful-twilio-functions
A set of useful Twilio Functions.
Stars: ✭ 53 (+165%)
Mutual labels:  twilio

Build Status npm version

twilio-taskrouter.js

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.

NOTE: This SDK is in a Developer Preview Release. This version of TaskRouter is intended for Twilio Flex. If you are using it outside of Twilio Flex, you may encounter bugs and instability, and the underlying APIs available in this release may change in subsequent releases.

Installation

NPM

npm install twilio-taskrouter

Usage

The following is a simple example showing a Worker waiting for Reservations. For more information, refer to the API Docs.

const TaskRouter = require('twilio-taskrouter');
const Twilio = require('twilio');
const AccessToken = Twilio.jwt.AccessToken;
const TaskRouterGrant = AccessToken.TaskRouterGrant;

const accountSid = '';
const signingKeySid = '';
const signingKeySecret = '';
const workspaceSid = '';
const workerSid = '';

const token = createAccessToken(accountSid, signingKeySid, signingKeySecret, workspaceSid, workerSid);
const alice = new TaskRouter.Worker(token);

alice.on('ready', readyAlice => {
    console.log(`Worker ${readyAlice.sid} is now ready for work`);
});

alice.on('reservationCreated', reservation => {
    console.log(`Reservation ${reservation.sid} has been created for ${alice.sid}`);
    console.log(`Task attributes are: ${reservation.task.attributes}`);

    reservation.on('accepted', acceptedReservation => {
      console.log(`Reservation ${acceptedReservation.sid} was accepted.`);
    });

    reservation.accept().then(acceptedReservation => {
      console.log(`Reservation status is ${acceptedReservation.status}`);
    }).catch((err) => {
      console.log(`Error: ${err}`);
    });
});

function createAccessToken(accountSid, signingKeySid, signingKeySecret, workspaceSid, workerSid) {
    const taskRouterGrant = new TaskRouterGrant({
        workerSid: workerSid,
        workspaceSid: workspaceSid,
        role: 'worker'
    });

    const accessToken = new AccessToken(accountSid, signingKeySid, signingKeySecret);
    accessToken.addGrant(taskRouterGrant);
    accessToken.identity = 'alice';

    return accessToken.toJwt();
}

Changelog

See CHANGELOG.md.

License

See LICENSE.md.

Building

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

Testing

  • Create a twilio account
  • copy ./test/integration_test_setup/.env.example to ./test/integration_test_setup/.env
  • set ACCOUNT_SID, AUTH_TOKEN, SIGNING_KEY_SID, SIGNING_KEY_SECRET
  • Run ./test/integration_test_setup/RunIntegrationTestLocal.sh this will create everything needed for running E2E tests and run the tests

Contributing

Bug fixes welcome! If you're not familiar with the GitHub pull request/contribution process, this is a nice tutorial.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].