Menu

Expand
Rate this page:

TwiML™ Voice: <Autopilot>

This Twiml Verb is not currently available when using Twilio Regions Ireland (IE1) or Australia (AU1). This is currently only supported with the default US1 region. A full list of unsupported products and features with Twilio Regions is documented here.

With Autopilot, you can build AI-powered conversational IVRs that recognizes user's intent, collects data from users, answers frequently (or infrequently) asked questions, and routes calls to other users.

Autopilot does the speech recognition and natural language understanding (NLU) to detect what users say and match it to Tasks that they need to acomplish. Tasks can be programmed to ask questions to collect data, answer questions or connect calls to other users. They are trained to recognize different phrases or ways users might invoke a given Task.

Learn more about Autopilot here or create your first Autopilot Assistant in the console.

You can use TwiML's <Autopilot> noun to connect a call to an Autopilot Conversational IVR.

The following example shows how to use the <Autopilot> TwiML noun. Within the opening and closing <Autopilot> tags, use the AssistantSid for the Autopilot assistant.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Connect>
    <Autopilot>UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</Autopilot>
  </Connect>
</Response>
Loading Code Sample...
        
        
        Toggle to your preferred programming language, or view the raw TwiML to see how the libraries and TwiML syntax differ

        Connect to <Autopilot>

        Toggle to your preferred programming language, or view the raw TwiML to see how the libraries and TwiML syntax differ

        <Connect> Attributes

        <Autopilot> supports the following attributes that change its behavior:

        Attribute name Allowed values Default value
        action URL (relative or absolute) current document URL
        method GET or POST POST

        action

        The action attribute takes an absolute or relative URL as a value. The Autopilot dialogue ends either by doing a handoff or the absence of a listen.

        If you do not provide an action parameter, Twilio will POST to the URL that houses the active TwiML document.

        <?xml version="1.0" encoding="UTF-8"?>
        <Response>
          <Connect action="https://www.example.com/autopilot">
            <Autopilot>UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</Autopilot>
          </Connect>
        </Response>

        Autopilot Parameters

        Parameter Description
        TargetTask

        A string representing the unique name of the destination Task. If no TargetTask is provided, the destination task is determined by the natural language understanding.


        TargetTask is useful when you want to control what task a user is routed to.

        Any call sent with a TargetTask parameter will start the Autopilot session on that task. This will override the initiation task specified in the defaults.

        Without an action URL, Twilio will re-request the URL that hosts the TwiML you just executed. This can lead to unwanted looping behavior if you're not careful. See our example below for more information.

        Useful Autopilot resources

        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.

        Loading Code Sample...
              
              
              

              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!

              thanks-feedback-gif