Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Deploying Flex Plugins

The following documentation assumes you are using FlexUI 1.8.0+. For older versions of Flex UI, you'll still access Flex Plugins via the Twilio Runtime domain and private Plugins are not available.

Additionally, some dependencies that you used to build your Flex Plugin, like React, are external to the Plugin. Visit the Plugin Builder Github repository to find the current list of external dependencies and their version so that you can ensure that your Plugin still works once it's deployed to your hosted Flex environment.

This is a guide on deploying Flex Plugins. To learn how to get started with Plugins, see the Quickstart on Getting Started with React Plugin Development.

Deploying Flex Plugins to Twilio Assets

Flex Plugins uploaded to Twilio Assets, whether public or private are routed through https://flex.twilio.com and look like: https://flex.twilio.com/plugins/plugin-test.js. Private Flex Plugins are not accessible via your Twilio Runtime domain and can only be retrieved with a valid Flex JWE Token via the aforementioned URL.

To start using private Plugins, upload your plugin as a private Twilio Asset via the Twilio Console. If you have an existing Plugin that's deployed as a public Twilio Asset, you may choose to re-upload it as a private Asset providing it fits within the limits below.

Limitations

Asset Type

Maximum Size

Quantity

Public

100 MB

500 Assets per account

Private

5 MB

10 Assets per account

The size and quantity of private assets may increase in future releases.

Deploying Flex Plugins from your own CDN

There are two additional mechanisms you can leverage to surface plugins within Flex beyond Twilio Assets by updating the plugin_service_attributes with the Flex Configuration API.

Attribute

Type

Purpose

custom_plugins

JSON array of Flex Plugins

custom_plugins enable you to statically define a list of Flex Plugins to return to Flex, this may be particularly useful to incorporate as part of a CI/CD workflow.

custom_plugins_url

A valid URL

custom_plugins_url must also return a JSON Array of plugins, but by leveraging the JWE token provided via the X-Flex-JWE header you may choose to conditionally return plugins to certain agents to satisfy use-cases such as segmentation by department or canary deployments.

Here's a CURL example of setting both fields:

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 of a duplicate name, this allows you to leverage custom_plugins as a fallback in the event your URL becomes inaccessible.

Rate this page:

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 browsing the Twilio tag on Stack Overflow.