Run Multiple Plugins Locally Using the Flex Plugins CLI
The twilio flex:plugins:start
command enables you to load multiple plugins on a local instance of Flex. It can load plugins either from the local source directory of a plugin or those that are currently enabled on your Flex application. This command makes it easier and quicker to test a plugin you are developing locally with other plugins.
Compatible CLI versions
You need to install the latest version of the Flex Plugins CLI in order to use these features. If you're migrating a legacy plugin to use the new CLI, refer to our Migration Guide.
Register existing plugins
Plugins on your development machine must be registered with the Plugins CLI if you want to include them in a test environment. To register your plugins:
Option 1: Download your plugin source using the CLI
twilio flex:plugins:create --template <github url of plugin> --install
Option 2: Register a plugin already on your machine
# Executed within the directory of your plugin
twilio flex:plugins:start
Run multiple plugins
The Plugins CLI can access any plugin that you have deployed to your Flex account (remote plugins) and any plugin that you are developing on your own machine (local plugins).
Using local plugins
You can choose the plugins you want to run locally by using the --name
argument. The name corresponds to the name field in the package.json
of your plugin. When you run the command in your plugin directory, you don't have to pass the name of the plugin.
plugin-agent-response $ twilio flex:plugins:start --name plugin-sample
The command does the following:
- Starts a local instance of Flex
- Since the command is being run in a plugin directory, it loads plugin-agent-response
- Since plugin-sample is being passed using the --name argument, it also loads the plugin plugin-sample
By default, your local Flex instance can be accessed from localhost:3000. If you see a login page, the 'Login with Twilio' option will log you into Flex without configuring SSO.
Refer to your Terminal output for information on the plugin directories being used by the local server:
Using remote plugins
Viewing plugins deployed on you Flex application
You can view the plugins currently deployed on your Flex application by accessing the Plugins Dashboard or by running the following command via the CLI
twilio flex:plugins:list:plugins
Including every remote plugin
Use the --include-remote
argument to load every plugin that is already enabled on your live Flex application. This shortcut allows you to test any new changes against your normal Flex environment, without manually downloading & running each plugin individually.
plugin-agent-response $ twilio flex:plugins:start --include-remote
The command does the following:
- Starts a local instance of Flex
- Since the command is being run in a plugin directory, it loads plugin-agent-response
- Since
--include-remote
is used, it accesses your live Flex application, fetches the list of all currently enabled plugins, and loads each of these alongside plugin-agent-response
If plugin-agent-response
is already deployed to your live Flex application, your local version will be used in place of the remote version.
An example output is shown below:
Including select remote plugins
You can use the @remote
tag if you only want to run a subset of your live plugins. The @remote tag will automatically load the version that is currently enabled on your Flex application. Each plugin you want to include must be identified with the --name
flag.
plugin-agent-response $ twilio flex:plugins:start --name plugin-agent-notes@remote
An example output is shown below:
Including select remote plugin version
You can choose a version of a plugin to load by using the format plugin name@version
. You need to ensure that the version has been deployed to your Flex application. This lets you run a remote plugin locally without enabling it on your account.
plugin-sample $ twilio flex:plugins:start --name plugin-agent-notes@1.0.0
An example output is shown below:
View all plugins registered by Flex Plugins CLI
This settings file is used to identify which plugins can be accessed by the CLI. If you remove or edit this file, you may need to re-register your plugins using the methods listed above.
The Plugins CLI keeps track of all your registered plugins in a settings file. To view details on your registered plugins:
macOS/Linux
cd & cat ~/.twilio-cli/flex/plugins.json
Windows
Run the following command in your Home Directory ( C:\Users\$USERNAME)
type .twilio-cli\flex\plugins.json
While testing your plugin across multiple Flex applications, we recommend switching your project within your remote Flex application and restarting your development server.
Next Steps
- Deploy your plugins to your agents, and keep your development environment up-to-date.
- Learn about other common use cases for the Plugins CLI.
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.