Exercise 1: Create a bot from an example - Amazon Lex

Exercise 1: Create a bot from an example

In this exercise, you create your first Amazon Lex V2 bot and test it in the Amazon Lex V2 console. For this exercise, you use the OrderFlowers example.

Example overview

You use the OrderFlowers example to create an Amazon Lex V2 bot. For more information about the structure of a bot, see How it works.

  • Intent – OrderFlowers

  • Slot types – One custom slot type called FlowerTypes with enumeration values: roses, lilies, and tulips.

  • Slots – The intent requires the following information (that is, slots) before the bot can fulfill the intent.

    • PickupTime (AMAZON.TIME built-in type)

    • FlowerType (FlowerTypes custom type)

    • PickupDate (AMAZON.DATE built-in type)

  • Utterance – The following sample utterances indicate the user's intent:

    • "I would like to pick up flowers."

    • "I would like to order some flowers."

  • Prompts – After the bot identifies the intent, it uses the following prompts to fill the slots:

    • Prompt for the FlowerType slot – "What type of flowers would you like to order?"

    • Prompt for the PickupDate slot – "What day do you want the {FlowerType} to be picked up?"

    • Prompt for the PickupTime slot – "At what time do you want the {FlowerType} to be picked up?"

    • Confirmation statement – "Okay, your {FlowerType} will be ready for pickup by {PickupTime} on {PickupDate}. Does this sound okay?"

To create an Amazon Lex V2 bot (Console)
  1. Sign in to the AWS Management Console and open the Amazon Lex console at https://console.aws.amazon.com/lex/.

  2. Choose Create bot.

  3. For the Creation method, choose Start with an example.

  4. In the Example bots section, choose OrderFlowers from the list.

  5. In the Bot configuration section give the bot a name and an optional description. The name must be unique in your account.

  6. In the Permissions section, choose Create a new role with basic Amazon Lex permissions. This will create an AWS Identity and Access Management (IAM) role with the permissions that Amazon Lex V2 needs to run your bot.

  7. In the Children's Online Privacy Protection Act (COPPA) section, make the appropriate choice.

  8. In the Session timeout and Advanced settings sections, leave the defaults.

  9. Choose Next. Amazon Lex V2 creates your bot.

After you create your bot, you must add one or more languages that the bot supports. A language contains the intents, slot types, and slots that the bot uses to converse with users.

To add a language to a bot
  1. In the Language section, choose a supported language, and add a description.

  2. Leave the Voice interaction and Intent classification confidence score threshold fields with their defaults.

  3. Choose Done to add the language to the bot.

After you choose Done, the console opens the intent editor. You can use the intent editor to examine the intents used by the bot. When you are done examining the bot, you can test it.

To test the OrderFlowers bot
  1. Choose Build at the top of the page. Wait for the bot to build.

  2. When the build is complete, choose Test to open the test window.

  3. Test the bot. Start the conversation with one of the sample utterances, such as "I would like to pick up flowers."

Next steps

Now that you've created you first bot using a template, you can use the console to create your own bot. For instruction on creating a custom bot, and for more information about creating bots, see Building bots.