Add the Interactions Service

Creating and Deploying an Amazon Lex Chatbot

The Amplify interactions feature will leverage Amazon Lex to create a chatbot - this is a collection of intents, slots and types to retrieve an order for a customer.

To begin, let’s add an interaction feature via the amplify add interactions command:

# Add Interactions capability via Amazon Lex
amplify add interactions

Add Interactions

Name the resource andyPizzaOrder and select Start from Scratch Add Interactions

Enter the following information to configure the bot settings:

  • Name for the bot: AndyPizzaOrder
  • Output voice: Female
  • Session timeout: 30
  • COPPA: No Add Interactions

Next, add an intent called OrderPizza and include 4 utterances:

  • i'd like a pizza
  • i'd like a {size} pizza
  • i'd like a {specialty} pizza
  • i'd like a {size} {specialty} pizza

An intent is an objective that you want your user to acheive. An utterance is a hint of what the user will say to acheive that objective. The words with the braces are called slots - think of these as parameters that you need to capture from your end user to acheive their objective.

Add Interactions

Next, add the following slots:

  • Slot Name: size
  • Slot Type: Create a new slot type
  • Slot Type Name: PizzaSize
  • Slot Description: The size of the pizza (Small, Medium, Large)
  • Slot Value: small
  • Slot Value: medium
  • Slot Value: large
  • Enter Prompt: What size of pizza?
  • Slot Required: Yes

Add Interactions

Choose to add another slot:

  • Slot Name: specialty
  • Slot Type: Create a new slot type
  • Slot Type Name: PizzaSpecialty
  • Slot Description: The type of pizza (Ultimate, etc)
  • Slot Value: ultimate
  • Slot Value: supreme
  • Slot Value: veggie
  • Slot Value: meat lovers
  • Enter Prompt: What type of pizza?
  • Slot Required: No

Add Interactions

Choose not to add confirmation, and then select Return parameters to client. Select No when asked to add another intent and your configuration is complete. Add Interactions

The amplify cli is very helpful in putting together a basic Chat Bot. However, this process can get very tedious for more complex chat bots. Instead of answering these questions one by one, you can edit the chatbot parameters by opening the file: amplify\backend\interactions\andyPizzaOrder\lex-params.json

Add Interactions

Push your changes to AWS:

amplify push

Add Interactions

You will receive a confirmation message once the chatbot is provisioned.

Add Interactions