Automate Flow Deployments with the Studio REST API v2, Now Generally Available

January 21, 2021
Written by
Alan Klein
Twilion
Zack Pitts
Twilion

Studio REST API v2 Hero

Twilio Studio has enabled thousands of developers to quickly build and deploy complex communication workflows and scale effortlessly on Twilio Runtime, our Serverless environment. Today Studio has made publishing and deployment of Flows even more powerful.

We are pleased to announce the general availability of Studio REST API v2, providing full support for publishing of Flows via the REST API, Twilio’s helper libraries, and the Twilio CLI.

Studio flows and automated deployments

A Studio flow is created using functional widgets with a drag and drop graphical user interface. Builders and developers alike have used the simple interface to create impressively powerful no-code and low-code workflows based on their specific needs.

How Chime used Twilio Studio to help deliver a seamless customer service experience.

As Studio evolved, customers began asking for ways to programmatically create, read, update, and delete flows. Behind the Studio graphical user interface, flows are simply a JSON object, so the Flows API allows you to programmatically control your Studio flows by manipulating this object—it's really that simple!

Take a look at the example below.

Trigger and Say/Play widget on a Studio canvas

First, select the Trigger widget. You can see the underlying JSON definition via the Trigger widget’s “Show Flow JSON” button on the right-hand side of the UI:

View the underlying JSON in a Twilio Studio flow

With the new Flows endpoint in v2, you can now easily automate:

  • Testing and deploying Flows through development, staging and production environments
  • Templatizing Flows to quickly provision new subaccounts
  • Integrating with your CI/CD pipeline for automated deployments and rollback
  • Updating Studio Flows as part of a larger, more complex Twilio deployment (e.g. Flex)
  • Moving flows between Twilio sub-accounts and Twilio Projects
  • Creating your own custom, branded Studio front-end UI!

What customers are saying 

The world without the Studio Flows API was super stressful on every deployment. Manually copying the Flow definition JSON from our pre-production account to production was error prone; we had to manually test our changes once in production.

Now that we’ve integrated the API into our CI/CD pipeline, we just move the JSON from one account to another, attach a test phone number to the just-deployed Flow, and call it automatically with our end-to-end tester to verify everything behaves as it should before attaching the real phone number. Not a single incident since!

– Bruno Kilian, Software Developer at Allianz Direct

How to get started

Twilio Developer Evangelist Dominik Kundel, walks us through—step-by-step—the process to integrate the Studio REST API v2 Flow Publishing API with Github Actions and create our own CI/CD pipeline. The code is available for free, on Twilio CodeExchange.

You can also try your hand at the Studio Flows API Quickstart, to see how a few simple CURL commands can be used to programmatically modify your own Studio flow.

It is simpler than ever to get started!

Additional Resources

Alan Klein is a Principal Solutions Engineer based in Atlanta, GA Office. Alan is a Serverless solution champion and Programmable Voice and Elastic SIP Trunking SIP Expert at Twilio. You can reach him at aklein [at] twilio.com or on Twitter at @SystemsEng.

Zack Pitts is the Product Manager for Twilio Studio. He can be reached at zpitts [at] twilio.com.