Menu

Expand
Rate this page:

TwiML Redirect

TwiML Redirect Widget.png

Description:

TwiML Redirect allows you to redirect a Voice Call to be handled outside of Studio and optionally return control back to Studio.

Passing Parameters to the TwiML Redirect widget

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

For example, if you wanted to pass the Digits variable from the Gather widget, you would enter the following in the URL field for the TwiML Redirect widget:

https://example.com/myfunction?Digits={{widgets.MY_WIDGET_NAME.Digits}}

Returning control to Studio

To handle returning control to Studio, you need to specify a <Redirect> to the Studio Webhook URL and append ?FlowEvent=return. Any additional parameters specified in the return URL will be injected into the Studio context and addressable via Liquid template variables.

Example:

<Response>
  <Say>Returning you back to the Studio Flow.</Say>
  <Redirect>https://webhooks.twilio.com/v1/Accounts/{AccountSid}/Flows/{FlowSid}?FlowEvent=return&foo=bar</Redirect>
</Response>

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

Tip: To retrieve the Studio Webhook URL, in your Studio flow, click the red Trigger widget. The URL starting with https://webhooks.twilio.com/v1/... is the Webhook URL.

Required Configuration:

Name

Description

Default

URL

URL where the call or message will be redirected.

None

Optional Configuration:

Name

Description

Default

Method

HTTP method to be used in the redirect

POST

Timeout

Number of seconds to wait for control to be returned to Studio. Set to 0 if returning control is not desired.

Possible values in seconds: 0 to 14400 seconds (4 hours)

14400

Transitions:

These are the events that trigger transitions from this widget:

Name

Key

Description

Return

return

Fired when the next TwiML fetch is received from Voice or Messaging for the current Execution

Timeout

timeout

Fired when the timer is expired, and no new TwiML fetch is received for the current Execution

Failed

failed

Fired when the URL is not successfully returned (or has an error)

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 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