Flex Plugins Library Utils
Overview
This package is a utility library to be used in serverless functions to interact with commonly used Twilio resources and APIs such as Taskrouter, Programmable voice etc.
Usage
Installation
npm install @twilio/flex-plugins-library-utils
Methods Usage
Currently this library exposes methods for Taskrouter APIs, Programmable voice, Phone numbers etc. and other services will get incremently added to it.
Below is an example code to fetch all workers in a Flex Taskrouter workspace.
import { TaskRouterUtils } from '@twilio/flex-plugins-library-utils';
import Twilio from 'twilio';
const config = {
maxBackoff: 2000,
minBackoff: 1000,
retryLimit: 3,
accountSid: 'YOUR_TWILIO_ACCOUNT_SID',
authToken: 'YOUR_TWILIO_AUTH_TOKEN',
flexWorkSpaceSid: 'YOUR_TWILIO_FLEX_WORKSPACE_SID',
};
const twilioClient = new Twilio('YOUR_TWILIO_ACCOUNT_SID', 'YOUR_TWILIO_AUTH_TOKEN');
const taskrouterClient = new TaskRouterUtils(client, config);
const workers = await trClient.getAllWorkersFromWorkspace({ attempts: 3 });