メニュー

Expand
ページを評価:

Redirect

Redirect routes the user to a different Task or URL. When redirecting to a Task, the target Task's Actions will be executed. When redirected to a URL, the Actions will be fetched from the URL and executed.

Redirecting to a URL allows you to dynamically generate the Actions JSON at any point of the dialogue. See The Autopilot Request documentation to see the parameters sent.

A maximum of 5 redirects is supported for any single request.

Example 1: Redirect to a Task

{
	"actions": [
		{
			"redirect": "task://customer-satisfaction-survey"
		}
	]
}

Redirecting to URLs

When redirecting to a URL, Redirect will make an HTTP callback to your application and will expect an Autopilot Actions JSON as a response. The request will contain all the dialogue information. This is an example of a dynamic Action since the JSON is rendered dynamically with a URL or your own endpoint.

リクエストパラメーター

See the Autopilot Request to see the callback parameters.

Example 2: Redirect to a URL

{
    "actions": [
        {
            "redirect": {
                  "uri": "https://example.com/actions",
                  "method": "POST"
            }
        }
    ]
}

Example 3: Redirect to a Twilio Function

When redirecting to a Twilio Function, Redirect will make an HTTP callback to your application and will expect an Autopilot Actions JSON as a response. The request will contain all the dialogue information. This is also an example of a dynamic Action since the JSON is rendered dynamically with a URL or your own endpoint.

Functions provide a serverless environment for writing event-driven code using node.js to build dynamic Twilio applications. Each Function has a unique URL that can be invoked by an HTTP request to run the code.

Your Task would contain code like this:

{
    "actions": [
        {
            "redirect": {
                  "uri": "https://your-twilio-function.twil.io/actions",
                  "method": "POST"
            }
        }
    ]
}

To create a new Function in your account and point it to the uri attribute, go to the Manage Functions page in the Twilio console here. Redirecting the dialogue to a Function is recommended to dynamically respond based on input from the user.

ページを評価:

ヘルプが必要ですか?

誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。

        
        
        

        フィードバックくださりありがとうございます!

        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!

        ステップ1

        Get link

        Get a free personal referral link here

        ステップ2:

        Give $10

        Your user signs up and upgrade using link

        ステップ3

        Get $10

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