Sometimes, you need to roll-back a Release. For example, maybe you pushed changes to your Flex contact center, found a bug, and now need to return to a previous stable version. The Plugins API makes it simpler and faster to do this.
Start by retrieving the list of Releases previously active on your account
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 listPluginRelease() {11const pluginReleases = await client.flexApi.v1.pluginReleases.list({12limit: 20,13});1415pluginReleases.forEach((p) => console.log(p.sid));16}1718listPluginRelease();
1{2"releases": [3{4"sid": "FKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"configuration_sid": "FJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"date_created": "2020-01-10T20:00:00Z",8"url": "https://flex-api.twilio.com/v1/PluginService/Releases/FKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9}10],11"meta": {12"page": 0,13"page_size": 50,14"first_page_url": "https://flex-api.twilio.com/v1/PluginService/Releases?PageSize=50&Page=0",15"previous_page_url": null,16"url": "https://flex-api.twilio.com/v1/PluginService/Releases?PageSize=50&Page=0",17"next_page_url": null,18"key": "releases"19}20}
From the list of Releases, choose the one that you want to roll-back to. Copy the configuration_sid of that release. You have to create a new Release with the configuration_sid copied in order to make it active on your Flex contact center.
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: "FJ10000000000000000000000000000000",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}
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!