Common Use Cases
This guide covers useful commands for interacting with your Flex plugins that are managed with the Flex Plugins CLI.
View all versions of a Flex plugin
twilio flex:plugins:list:plugin-versions --name <plugin name>
View all Flex plugins you have deployed
The list
command displays all the plugins that can be enabled or disabled.
$ twilio flex:plugins:list:plugins
View your active plugins
twilio flex:plugins:describe:release --active
Rollback a release
Sometimes you push changes to your application that need to be reverted and fixed. You can use the Plugins CLI to return to a previous version of your plugin configuration.
Fetch previous releases
twilio flex:plugins:list:releases
Choose a prior configuration
From the list of Releases, choose the one that you want to rollback to. Copy the configuration_sid
of that release.
Use the describe
command to get details on the Configuration.
twilio flex:plugins:describe:configuration --sid <Configuration Sid>
Create a new release from your prior configuration
Create a new Release with the copied configuration_sid.
twilio flex:plugins:release --configuration-sid <Configuration Sid>
Whew! You've successfully rolled back your Contact Center to an operational version. Go hunt down that bug, and get ready to cut a new Release with the revised Plugin Code!
Disable a plugin
Use the disable-plugin
argument on the release command to disable a plugin on your Flex application. The format it takes is pluginName.
twilio flex:plugins:release --disable-plugin plugin-agent-autoresponse --name "Flex Next" --description "Remove Agent Autoresponse Plugin"
Deploy multiple plugins
twilio flex:plugins:release --plugin <plugin-name1>@<version> --plugin <plugin name2>@<version> --name "Sprint Snow Leopard" --description "Agent Productivity Tools"
You can group multiple plugins into a single Release. The twilio flex:plugins:release
command takes multiple plugin names in its argument. Keep in mind that you need to first deploy the versions of the plugins being referred in the command before using it in the release command.
Compare your configuration with the active release
Use the diff
command to compare two configurations in your Flex application. If you leave the second parameter blank, it will compare the Configuration to the active Release.
twilio flex:plugins:diff <Configuration SID>
Deploy to your own CDN
There are two mechanisms you can use to serve plugins external to Twilio Assets. The Flex Configuration Resource provides plugin_service_attributes
, which can be used to register external assets for Flex to load.
Attribute |
Type |
Purpose |
custom_plugins |
JSON array of Flex Plugins |
|
custom_plugins_url |
A valid URL |
|
Only one of these fields is required. This curl
example demonstrates the syntax for updating either attribute.
curl https://flex-api.twilio.com/v1/Configuration -X POST -u ACxx:auth_token \
-H 'Content-Type: application/json' \
-d '{
"account_sid": "ACxx",
"plugin_service_attributes": {
"custom_plugins": [{"name": "My Plugin", "version": "0.0.1", "src": "https://example.com/my-self-hosted-plugin-0.0.1.js"}],
"custom_plugins_url": "https://example.com/plugins-list.json"
}
}'
custom_plugins_url
takes precedence over custom_plugins
in the event that both appear. This allows you to leverage custom_plugins
as a fallback if your URL is inaccessible.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.