Vielen Dank für Ihren Besuch. Diese Seite ist momentan nur auf Englisch verfügbar. Wir arbeiten an der deutschen Version. Vielen Dank für Ihr Verständnis.

Create the Interaction Model for Your Skill

With the Alexa Skills Kit, you can create skills with a custom interaction model. You implement the logic for the skill, and you also define the voice interface through which users interact with the skill. To define the voice interface, you map users' spoken input to the intents your cloud-based service can handle.

To declare this mapping, you supply the following inputs:

  1. Intents: An intent represents an action that fulfills a user's spoken request. Intents can optionally have arguments called slots.
  2. Sample utterances: A set of likely spoken phrases mapped to the intents. This should include as many representative phrases as possible.
  3. Custom slot types: A representative list of possible values for a slot. Custom slot types are used for lists of items that are not covered by one of Amazon's built-in slot types.
  4. Dialog model (optional): A structure that identifies the steps for a multi-turn conversation between your skill and the user to collect all the information needed to fulfill each intent. This simplifies the code you need to write to ask the user for information.

This document defines these components and explains how to create them within developer console.

About Intents, Slots, and Dialogs

This section provides a brief overview of the components of an interaction model:

Intents and Slots

An intent represents an action that fulfills a user's spoken request. Intents can optionally have arguments called slots. For example, a skill for planning a trip might define an intent named PlanMyTrip that has slots named fromCity, toCity, and travelDate. A user can then say:

User: Alexa, ask Plan My Trip to plan a trip from Seattle to Portland on Friday.

The Alexa service sends the Plan My Trip service a PlanMyTrip intent with the value "Seattle" in the fromCity slot, "Portland" in the toCity slot and the date for the next upcoming Friday travelDate slot. The service can then save this information and send back text to convert to speech.

Slots are defined with different types. The travelDate slot in the above example uses Amazon's built-in AMAZON.DATE type to convert words that indicate dates (such as "today" and "next friday") into a date format, while both fromCity and toCity use the built-in AMAZON.US_CITY slot. If you extended this skill to ask the user what activities they plan to do on the trip, you might add a custom LIST_OF_ACTIVITIES slot type to reference a list of activities such as "hiking", "shopping", "skiing", and so on.

Amazon provides built-in support for a large library of slot types. This includes:

All built-in types have the prefix AMAZON.

To learn how to create intents and slots in the developer console, see Create Intents, Utterances, and Slots.

For more about designing skills and identifying your intents and slots, see the Voice Design Guide:

Sample Utterances

The sample utterances specify the words and phrases users can say to invoke your intents. Each intent is mapped to several utterances. Slots are indicated within the utterances with curly brackets. For example, this utterance for PlanMyTrip includes the toCity slot:

i want to visit {toCity}

To learn how to create utterances in the developer console, see Create Intents, Utterances, and Slots.

For more about writing good sample utterances, see What Users Say.

Multi-turn Conversations and the Dialog Model

In an Alexa skill, a dialog with the user is a conversation with multiple turns in which Alexa asks questions and the user responds with the answers. The conversation is tied to a specific intent representing the user's overall request. The questions and answers are intended to gather and confirm values for all of the intent's required slots. The conversation continues until all slots needed for the intent are filled and confirmed.

You can use the developer console to define a dialog model. This structure identifies:

  • The slots that must be filled with valid values in order to fulfill the intent. These are considered required slots.
  • The prompts Alexa speaks to ask for required slot values and the utterances users can say in reply.
  • Whether any of the required slots must be also confirmed by the user before continuing.
  • Whether the entire intent must be confirmed by the user before continuing.
  • The prompts Alexa speaks to ask for slot and intent confirmations.

To use the dialog model in your skill, return the Dialog.Delegate directive. Alexa then determines the next step and uses the defined prompts to ask the user for information. This lets you delegate the conversation to Alexa, rather than writing your own code to ask the user for slot values and confirmations.

You can also manage the conversation manually, or use a combination of delegation and other options. See About Managing the Conversation with the User.

To learn how to define a dialog model in developer console, see Define the Dialog to Collect and Confirm Required Information.

High-level Steps to Create the Interaction Model and Dialog Model

The developer console is designed around defining each intent, its slots, its utterances, and (optionally) the prompts Alexa uses when conversing with the user to collect and confirm the slot values.

Once you know an intent you want to create for your skill, follow these high-level steps in the developer console. See the sections below for details:

  1. Create or edit a skill that includes the custom interaction model.
  2. Create an intent and write some initial utterances. An intent represents a specific user request (for example, PlanMyTrip intent for gathering information about a trip to save in a list).
  3. Review your initial utterances and identify the words or phrases that represent variable information. Create new intent slots for these words and replace the words with slot notation in the utterances.
  4. Choose or create the appropriate slot types for the slots you have identified.
  5. For each intent slot, determine whether the slot value is required in order to fulfill the request. Write the prompts and utterances Alexa uses in the conversation to elicit the slot.
  6. For each required slot, determine whether the user must explicitly confirm the slot value before your skill completes the request. Write the prompts Alexa should use to ask for confirmation.
  7. For the entire intent, decide whether the user must explicitly confirm the action before your skill completes the request. Write the prompts Alexa should use to ask for confirmation.
  8. When you are finished defining the intents, save and build the interaction model and dialog model.

If you include any of the dialog model components (required slots, slot confirmation, or intent confirmation) your code needs to return the Dialog.Delegate to let Alexa use your prompts to ask the user for the required slots and confirmations. Also see About Managing the Conversation with the User for other ways to collect and confirm user information.

Save and Build the Model

As you create and edit your interaction model and dialog model, save your work with the Save Model button. This saves your data without also attempting to build the model.

When you are ready to test your interaction model, go to any of the sections under Custom > Interaction Model and click Build Model to validate, save, and build your interaction model. Building the model can take several minutes. You can continue to make changes, but they won't be reflected in the build. The developer console displays a success message once the build completes.

You must successfully build the model before you can test it.

View and Edit the JSON Code for the Interaction Model and Dialog Model

When using the developer console, you can see your invocation name, intent schema, sample utterances, and dialog model in JSON format. You can make changes directly to this code and apply them to your interaction model.

Click JSON Editor to see the JSON version of your model. If you make any changes, be sure to click Save Model to apply the changes to your model.

For details about the JSON format for the interaction model, see Interaction Model Schema.