Define Responses from Alexa for Alexa Conversations


When an interaction between the skill and the user triggers Alexa Conversations to invoke an API in your skill code, you use a response to format and return the API output to the user. You do so by using the Alexa text-to-speech (TTS) engine.

For example, when the user asks a weather skill for the weather, the output of the GetWeather API might be the city, date, high temperature, and low temperature as follows.

User: What's the weather?
Alexa: In what city?
User: Seattle.
Alexa: In Seattle, it's 70 degrees.

You define a response for Alexa to pass this information to the user with TTS that includes variables. In the previous example, you might define the TTS to be In ${payload.returnedWeather.city}, it's ${payload.returnedWeather.temperature} degrees.

You specify the TTS or visual response as Alexa Presentation Language for Audio (APLA) and Alexa Presentation Language (APL), respectively.

Overview of responses

Responses consist of the following elements:

  • Audio response – (Required) The TTS is in an APLA document. For details about APLA, see APL for Audio Reference. APLA documents can incorporate input arguments that pass into the response.

    In the previous example, the APLA document might contain the following text in its content field: In ${payload.returnedWeather.city}, it's ${payload.returnedWeather.temperature} degrees.
  • Visual response – (Optional) To specify a visual response, you use Alexa Presentation Language. For details, see Add Visuals and Audio to Your Skill.

  • Arguments – (Optional) If a response requires information from the API that triggered it, you specify input arguments to the response. For example, perhaps you create a weather skill. Your GetWeather API might return a returnedWeather slot type that contains a field for the city, date, high temperature, and low temperature. Alexa Conversations passes these fields to the response template as an input argument.

Use multiple responses

To reduce the number of dialogs, you can have multiple responses in a single Alexa turn. Adding multiple responses reduces the number of dialogs because you can cover any combination of arguments (when requesting arguments), confirming arguments, or confirming an API. The user interface also suggests responses when possible, to help you increase coverage of dialog variations.

Confirm arguments

Alexa can confirm arguments in a single turn, and then, if the user denies the arguments, Alexa can request the arguments again. To use this feature, use the Confirm Args or Confirm API response act when you configure the dialog. For the response, specify a prompt such as, "Do you want the weather for {city} on {date}?" For a tutorial that demonstrates how to confirm arguments, see Tutorial: Confirm API Arguments for Alexa Conversations.

Examples

For examples of how to create responses while configuring a dialog, see Step 5: Edit audio responses in Tutorial: Annotate a Dialog for Alexa Conversations.

For a list of built-in Alexa responses that you can use in your skill, see Built-in Response Reference for Alexa Conversations.


Was this page helpful?

Last updated: Nov 27, 2023