Twilio

Redirect Verb

The <Redirect> verb transfers control to a different URL.

Nouns

The "Noun" of a Twilio verb is the body of the element, the thing the verb acts upon. In the case of <Redirect>, the noun is an absolute or relative URL to a different URL.

Form Parameters

The <Redirect> verb does not submit any information.

Verb Attributes

Attribute Name Allowed Values Default Value
method GET,POST POST

method

The method attribute takes the value GET or POST. This tells Twilio whether to <Redirect> using an HTTP GET or POST. POST is the default.

Nesting Rules

The <Redirect> verb can be nested in the following elements

The following verbs can be nested within <Redirect>

  • none

Examples

Example 1: Absolute URL Redirect

<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Dial>415-123-4567</Dial>
     <Redirect>
        http://www.foo.com/nextInstructions
     </Redirect>
</Response>

In this example, we have a <Redirect> verb after a <Dial> verb with no URL. When the <Dial> verb finishes, the <Redirect> executes. <Redirect> makes a request to http://www.foo.com/nextInstructions and transfers control to a different URL.

Example 2: Relative URL Redirect

<?xml version="1.0" encoding="UTF-8"?> 
<Response> 
    <Redirect> 
        ../nextInstructions 
    </Redirect> 
</Response> 

Redirects flow control to a the specified URL relative to the current URL.