@twilio/flex-plugins-library-utils
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

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 });

/@twilio/flex-plugins-library-utils/

    Package Sidebar

    Install

    npm i @twilio/flex-plugins-library-utils

    Weekly Downloads

    4,180

    Version

    1.1.7

    License

    Apache-2.0

    Unpacked Size

    308 kB

    Total Files

    101

    Last publish

    Collaborators

    • flex-runtime