The Queued Callback and Voicemail for Flex plugin helps Flex admins automate handling of agent callback requests from customers instead of having them wait longer in a queue.
To deploy this plugin, you will need:
-
An active Twilio account with Flex provisioned. Refer to the Flex Quickstart to create one.
-
npm version 5.0.0 or later installed (type
npm -v
in your terminal to check) -
Node version 12.21 or later installed (type
node -v
in your terminal to check) -
Twilio CLI along with the Flex CLI Plugin and the Serverless Plugin. Run the following commands to install them:
# Install the Twilio CLI npm install twilio-cli -g # Install the Serverless and Flex as Plugins twilio plugins:install @twilio-labs/plugin-serverless twilio plugins:install @twilio-labs/plugin-flex
-
A GitHub account
Before we begin, we need to collect all the config values we need to run the application:
Config Value | Description |
---|---|
Account Sid | Your primary Twilio account identifier - find this in the Console. |
Serverless Deployment Domain | The resulting Serverless domain name after deploying your Twilio Functions |
Workspace SID | Your Flex Task Assignment workspace SID - find this in the Console TaskRouter Workspaces page |
After the above requirements have been met:
- Clone this repository
git clone git@github.com:twilio-labs/plugin-queued-callbacks-and-voicemail.git
- Change into the
public
subdirectory of the repo and run the following:
cd plugin-queued-callbacks-and-voicemail/public && mv appConfig.example.js appConfig.js
- Install dependencies
npm install
-
Run the application
twilio flex:plugins:start
See Twilio Account Settings to locate the necessary environment variables.
- Run the application
npm start
Alternatively, you can use this command to start the server in development mode. It will reload whenever you change any files.
npm run dev
- Navigate to http://localhost:3000
That's it!
You need to deploy the functions associated with the Callback and Voicemail Flex plugin to your Flex instance. The functions are called from the plugin you will deploy in the next step and integrate with TaskRouter, passing in required attributes to generate the callback and voicemail tasks, depending on the customer selection while listening to the in-queue menu options.
- From the root directory of your copy of the source code, change into
serverless
and rename.env.example
to.env
.
cd serverless && mv .env.example .env
- Open
.env
with your text editor and modify TWILIO_WORKSPACE_SID with your Flex Task Assignment SID.
TWILIO_WORKSPACE_SID=WSxxxxxxxxxxxxxxxxxxxxxx`
- To deploy your Callback and Voicemail functions and assets, run the following:
$ twilio serverless:deploy --assets
## Example Output
Deploying functions & assets to the Twilio Runtime
Env Variables
⠇ Creating 4 Functions
✔ Serverless project successfully deployed
Deployment Details
Domain: plugin-queued-callbacks-voicemail-functions-xxxx-dev.twil.io
Service:
plugin-queued-callbacks-voicemail-functions
Functions:
https://plugin-queued-callbacks-voicemail-functions-xxxx-dev.twil.io/inqueue-callback
https://plugin-queued-callbacks-voicemail-functions-xxxx-dev.twil.io/inqueue-utils
https://plugin-queued-callbacks-voicemail-functions-xxxx-dev.twil.io/queue-menu
https://plugin-queued-callbacks-voicemail-functions-xxxx-dev.twil.io/inqueue-voicemail
Assets:
https://plugin-queued-callbacks-voicemail-functions-xxxx-dev.twil.io/assets/alertTone.mp3
https://plugin-queued-callbacks-voicemail-functions-xxxx-dev.twil.io/assets/guitar_music.mp3
Note: Copy and save the domain returned when you deploy a function. You will need it in the next step. If you forget to copy the domain, you can also find it by navigating to Functions > API in the Twilio Console.
Debugging Tip: Pass the -l or logging flag to review deployment logs. For example, you can pass
-l debug
to turn on debugging logs.
Once you have deployed the function, it is time to deploy the plugin to your Flex instance.
Run the following commands in the plugin root directory. We will leverage the Twilio CLI to build and deploy the Plugin.
-
Rename
.env.example
to.env
. -
Open
.env
with your text editor and modify theREACT_APP_SERVICE_BASE_URL
property to the Domain name you copied in the previous step. Make sure to prefix it with "https://".plugin-queued-callbacks-and-voicemail $ mv .env.example .env # .env REACT_APP_SERVICE_BASE_URL=https://plugin-queued-callbacks-voicemail-functions-4135-dev.twil.io
-
When you are ready to deploy the plugin, run the following in a command shell:
plugin-queued-callbacks-and-voicemail $ twilio flex:plugins:deploy --major --changelog "Updating to use the latest Twilio CLI Flex plugin" --description "Queued callbacks and voicemail"
-
To enable the plugin on your contact center, follow the suggested next step on the deployment confirmation. To enable it via the Flex UI, see the Plugins Dashboard documentation.
The serverless implementation can be customized using the file options.private.js
. Options include:
sayOptions
: Attributes for the<Say>
verb used to prompt the customer. You can read more about these attributes and their values on TwiML™ Voice:<Say>
holdMusicUrl
: Relative or absolute path to the audio file for hold music (default:/assets/guitar_music.mp3
). If no domain is provided (i.e. relative path), the serverless domain will be used.getEwt
: Enable Estimated Waiting Time in voice prompt (default:true
)statPeriod
: Time interval (in minutes) for Estimated Waiting Time stats evaluation (default:5
minutes)getQueuePosition
: Enable Queue Position in voice prompt (default:true
)VoiceMailTaskPriority
: Priority for the Task generatared by the VoiceMail (default:50
)VoiceMailAlertTone
: Relative or absolute path to the ringback tone that Twilio will play back to the Agent when calling a customer from a voice mail task (default:/assets/alertTone.mp3
). If no domain is provided (i.e. relative path), the serverless domain will be used. This is not currently implemented in the Flex plugin, and it's for future usageCallbackTaskPriority
: Priority for the Task generatared by VoiceMail (default:50
)CallbackAlertTone
: Relative or absolute path to the ringback tone that Twilio will play back to the Agent when calling a customer from a callback task (default:/assets/alertTone.mp3
). If no domain is provided (i.e. relative path), the serverless domain will be used. This is not currently implemented in the Flex plugin, and it's for future usageTimeZone
: Timezone configuration. This is used to report time and date of voicemail (defaultAmerica/Los_Angeles
)
No warranty expressed or implied. Software is as is.