Rate this page:

TwiML Redirect Widget

Studio uses Widgets to represent various parts of Twilio's functionality that can then be stitched together in your Studio Flow to build out robust applications that require no coding on your part.

New to Twilio Studio? Check out our Getting Started Guide!

The TwiML Redirect Widget allows you to redirect a call or message to TwiML hosted somewhere other than your Studio Flow and, optionally, return control of the call back to Studio after the TwiML you redirect to is complete.

A TwiML Redirect widget: a rectangular box with a title "redirectTwiML (Add TwiML Redirect)", a URL listed below the title, and handlers for return, timed, and failed.

The URL you redirect to with this Widget must host valid TwiML. TwiML can be hosted and served in many ways, including but not limited to:

TwiML, or the Twilio Markup Language, is an XML-based language which instructs Twilio on how to handle various events such as incoming and outgoing calls, SMS messages and MMS messages. Learn more about it here.

Required configuration for TwiML Redirect

The TwiML Redirect Widget requires only one piece of information to function properly:

Name Description Example Default
URL The URL hosting your TwiML where you want your Studio Flow to redirect the call or message. None

Note: Studio does not actually make the HTTP request to this URL. Instead, Studio prints the TwiML, which instructs Twilio Voice or Messaging to make a new request to the URL you specify.

How to pass parameters to a TwiML Redirect URL

If you want to pass parameters to a TwiML Redirect URL from your Studio Flow, you can pass them in a query string as part of your URL.

For example, if you want to pass the Digits variable from the Gather widget, you should enter the following in the URL field for the TwiML Redirect widget:{{widgets.MY_WIDGET_NAME.Digits}}

How to return control to Studio

To return control of the call or message to Studio, you must specify a <Redirect> to your Studio Webhook URL and append ?FlowEvent=return. Studio will inject any additional parameters specified in the return URL to your Studio context. These parameters will then be available in your Studio Flow via Liquid template variables.


  <Say>Returning you back to the Studio Flow.</Say>

The URL parameter foo illustrated above will be passed automatically into your Flow and can be referenced via Liquid as {{}}.

Tip: To retrieve the Studio Webhook URL in your Studio flow, click the red Trigger widget. The URL starting with is the Webhook URL for this Flow.

Optional configuration for TwiML Redirect

The TwiML Redirect Widget accepts a few configuration options that you can use to further customize how Studio redirects to your URL that hosts TwiML, and returning control back to Studio:

Name Description Possible Values Default
Method The HTTP method Twilio should use when accessing your redirect URL POST, GET POST

The number of seconds your Studio Flow will wait for control to return to it after the redirect. If you do not wish to return control to Studio, set this value to 0.

0 to 14400 seconds (4 hours) 14400

TwiML Redirect Transitions

These events trigger transitions from this Widget to another Widget in your Flow:

Name Description
Return Control has been returned to Studio by Twilio Voice or Messaging TwiML by appending the parameter FlowEvent=return to your TwiML redirect URL
Timeout The timeout timer expired and control has not passed back to Studio via the FlowEvent=return parameter
Failed The URL is invalid and cannot be parsed at runtime, therefore Studio cannot complete the request. Note that the Failed state will not occur if your URL returns an error (e.g., 404, 500)

Regaining control of a Voice call

Please note that your Studio Flow will not be able to regain control of a Voice call that is timed out after passing the call to your TwiML Redirect URL. The only way your Studio Flow can regain control of a Voice call that has been passed to a TwiML URL is if you first append the parameter FlowEvent=return to your URL. This will tell the TwiML that executes to return control back to Studio when execution is complete.

Learn more

Want to learn more about how you can use TwiML Redirects to customize your Studio Flow? Check out these guides:

We can't wait to see what you build!

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


        Thank you for your feedback!

        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

        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