Menu

Studio Flows, Functions, Assets, TwiML

Twilio Studio is a powerful visual editor for building, editing, and managing communication workflows. The Studio Canvas is the visual flow editor and is accessible through the Console.

You can use Studio to craft everything from order notifications, to conversational IVRs, to survey tools and SMS-enabled chatbots.

Studio Flows

By default, Studio Flows serve as the entry point for all calls and messages within Flex. Out of the box, Flex includes three Studio Flows:

  • Voice IVR
  • Messaging Flow
  • Webchat Flow

These flows use the Send To Flex widget to send contacts to a TaskRouter Workflow and Task Channel for agent assignment.

callback-voicemail-studio-flow

For examples of how to modify Flex Studio Flows, see Using Twilio Studio with Flex.

Widgets

A Studio Flow consists of Widgets, which serve as the basic building blocks of functionality specific to the communication channel being used. It begins with the Trigger widget, and from there, you can drag and drop Widgets to build the exact flow to meet your contact center use case. Common widgets include Say/Play (for saying or playing a message on a voice call), and Send & Wait for Reply (for sending a text-based message and waiting for a user response). For a complete list of Studio widgets, see the Widget Library.

When an end user interacts with a Studio Flow, it creates an Execution that takes the user through each Widget until completion. An Execution typically represents a single phone call or a chatbot conversation. As a Studio flow executes, its state and associated data are saved in the Execution Context. The data in the Execution Context can be accessed within a Studio Flow as variables using the Liquid Template Language.

Send to Flex

The Send To Flex widget is a Studio widget that transfers a call or a message to Flex by creating a task within the TaskRouter. Voice calls are enqueued and the caller will hear hold music while waiting for an agent to respond. Messages are transferred to Flex as new tasks for assignment to an agent. The widget requires a Workflow and a Task Channel. Optionally, you can declare task attributes, priority, timeout, and a hold music TwiML URL. You can use the Send To Flex widget with Autopilot for enabling handoff between a voice or chat Autopilot bot and a human agent. To learn more, see Send to Flex.

Studio REST API v2

The Studio REST API v2 allows you to programmatically create, publish, and manage your Studio Flows without having to log in to the Twilio Console. Studio Flows are defined using a JSON schema to configure the the widgets and the functionality. The REST API also provides methods to trigger an outbound call or a message as well as endpoints for reporting on Executions that have completed.

Functions and Assets

Twilio Functions is a serverless development environment which lets you build event-driven and scalable Twilio applications. Functions are small units of server-side code written in Node.js and run directly on the Twilio platform. They natively integrate with Studio so you can extend your Studio Flows and Flex plugins with custom functionality.

Functions replaces your need to find hosting or run a server to serve TwiML or any other HTTP-based responses. You no longer have to worry about maintaining or scaling your web infrastructure to support your application. To learn more, see Getting Started with Serverless and Twilio Functions.

Assets provide the ability to upload and serve text and media files on the Twilio server which can be accessed using Functions to build custom communication applications. To learn about the different types of Assets you can host, see How Assets Work.

TwiML

TwiML (the Twilio Markup Language) is a set of instructions you can use to tell Twilio what to do when you receive an incoming call or SMS.

How TwiML works

When someone makes a call or sends a message to one of your Twilio numbers, Twilio looks up the URL associated with that phone number and sends it a request. Twilio then reads the TwiML instructions returned by that endpoint to determine what to do—whether it's recording the call, playing a message for the caller, or prompting the caller to press digits on their keypad.

At its core, TwiML is an XML document with special tags defined by Twilio to help you build your Programmable Voice or Messaging application. TwiML verbs are the underlying output of Studio that tell Twilio systems what actions to take on a given call or message. Because of this, most elements in a TwiML document are TwiML verbs. Verb names are case-sensitive, as are their attribute names.

TwiML for Voice

TwiML for Voice instructions define how inbound and outbound calls are handled on your Twilio phone number. While Twilio executes just one TwiML document to the caller at a time, you can link many TwiML documents together as a flow to build a complex IVR application.

You can use different combinations of TwiML verbs to create all kinds of interactive voice and messaging applications for Flex. Voice verbs commonly used with Flex include <Say>, <Gather>, <Pay>, <Play>, <Record>, <Enqueue>, <Dial>, <Connect>, <Autopilot>, and <Stream>.

To learn more about how TwiML works with voice, the different elements, and the TwiML interpreter, see TwiML for Programmable Voice.

TwiML for SMS

TwiML for SMS instructions define how inbound messages are handled on your Twilio phone number. When Twilio receives a message for one of your Twilio numbers or channels, it makes a synchronous HTTP request to the message URL configured for that number or channel and expects to receive TwiML in response. Twilio sends additional parameters when there are media (such as images) associated with the message. The two TwiML for Messaging verbs are <Message> and <Redirect>.

To learn more about how TwiML works with SMS, and the TwiML interpreter, see TwiML for Programmable SMS.

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 by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

Thank you for your feedback!

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

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more