So, you've already created a Release that contains a few Plugin Versions. This guide takes you through the steps of how to roll out a new version of a plugin that is already active on your contact center or introduce a new plugin in your Flex contact center.
The recommended flow involves retrieving the currently active Release and the configuration associated with it. You can copy the list of current Plugins from the Configuration, and make your desired updates to the list. You need to then create a new Configuration, and finally, cut a new Release.
All of these steps can be accomplished via API - read on to get more detailed instructions.
Start by fetching the active Release. This will show you the current Configuration SID.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchPluginRelease() {11const pluginRelease = await client.flexApi.v112.pluginReleases("Active")13.fetch();1415console.log(pluginRelease.sid);16}1718fetchPluginRelease();
1{2"sid": "Active",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"configuration_sid": "FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"date_created": "2020-01-10T20:00:00Z",6"url": "https://flex-api.twilio.com/v1/PluginService/Releases/FKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"7}
Start by fetching the active Release. This will show you the current Configuration SID. You can read the plugins active on Flex, by looking up the configuration by the Configuration SID
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchPluginConfiguration() {11const pluginConfiguration = await client.flexApi.v112.pluginConfigurations("FJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.fetch();1415console.log(pluginConfiguration.sid);16}1718fetchPluginConfiguration();
1{2"sid": "FJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"name": "some name",5"description": "description",6"archived": false,7"date_created": "2020-01-10T20:00:00Z",8"url": "https://flex-api.twilio.com/v1/PluginService/Configurations/FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"links": {10"plugins": "https://flex-api.twilio.com/v1/PluginService/Configurations/FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Plugins"11}12}
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listConfiguredPlugin() {11const plugins = await client.flexApi.v112.pluginConfigurations("FJ10000000000000000000000000000000")13.plugins.list({ limit: 20 });1415plugins.forEach((p) => console.log(p.accountSid));16}1718listConfiguredPlugin();
1{2"plugins": [],3"meta": {4"page": 0,5"page_size": 50,6"first_page_url": "https://flex-api.twilio.com/v1/PluginService/Configurations/FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Plugins?PageSize=50&Page=0",7"previous_page_url": null,8"url": "https://flex-api.twilio.com/v1/PluginService/Configurations/FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Plugins?PageSize=50&Page=0",9"next_page_url": null,10"key": "plugins"11}12}
Use the information from the old configuration to create a new Configuration. In this case, add the new Plugin Version SID you want to roll out to your Flex account, to the list of existing SIDs.
You could also update or remove an existing Plugin Version from the list.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createPluginConfiguration() {11const pluginConfiguration =12await client.flexApi.v1.pluginConfigurations.create({13description: "This is a new configuration",14name: "Name",15plugins: [16{17plugin_version: "FV00000000000000000000000000000000",18},19{20plugin_version: "FV10000000000000000000000000000001",21},22],23});2425console.log(pluginConfiguration.sid);26}2728createPluginConfiguration();
1{2"sid": "FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"name": "Name",5"description": "This is a new configuration",6"archived": false,7"date_created": "2020-01-10T20:00:00Z",8"url": "https://flex-api.twilio.com/v1/PluginService/Configurations/FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"links": {10"plugins": "https://flex-api.twilio.com/v1/PluginService/Configurations/FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Plugins"11}12}
Finally, you're ready to create a new Release.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createPluginRelease() {11const pluginRelease = await client.flexApi.v1.pluginReleases.create({12configurationId: "FJ10000000000000000000000000000001",13});1415console.log(pluginRelease.sid);16}1718createPluginRelease();
1{2"sid": "FKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"configuration_sid": "FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"date_created": "2020-01-10T20:00:00Z",6"url": "https://flex-api.twilio.com/v1/PluginService/Releases/FKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"7}
Congratulations - you've successfully rolled out new changes to your contact center, and should see your updated Plugins on the Developer Setup Page in Flex.