Chatbot Beginner with Amazon Lex - V1

Chatbot Beginner with Amazon Lex - V1

Cayenne Teoh Wan Ching's photo
Cayenne Teoh Wan Ching

Published on Oct 30, 2020

3 min read

Subscribe to my newsletter and never miss my upcoming articles

Chatbot with auto-reply is a very common business implementation nowadays to help in reducing the needs of manpower and the time consuming process of replying customers one by one.

I had tried implementing such service provided by cloud platforms such as DialogFlow in GCP and Amazon Lex in AWS. There are some obvious differences between these two services as in the terms used and the logic low.

However, this purpose of sharing this post is to talk about Amazon Lex. Let's look into some key points of the implementation.

Terms used in Amazon Lex

  1. Intent: User's intention as in what user is going to do with this chatbot (Eg: Room booking? Hotel reservation?).
  2. Utterances: Phrases that will trigger the intents (Eg: I want to book a room / I want to make a hotel reservation).
  3. Prompt: Question that ask user to input the required slot (Eg: What is the preferable type of bed?).
  4. Slot: Data that user must provide in order to fulfill the intent based on the prompts. If the slot value is not fulfilled, then the prompt will be failed (Eg: If the prompt is asking about bed type, answering "Queen bed" will pass the intent, but answering "January" will fail the intent).
  5. Fulfillment: Business logic that fulfills the intent (Eg: Save user input into a storage, send request to an API to validate user input and return a response to user, return a simple response).

Integration with AWS Lambda

  1. User Input Validation: The business logic to start the conversation in a specific intent.
  2. Intent Fulfillment: The business logic to end the conversation in a specific intent.

Steps

  • Create an intent and define the intent name.

intent.PNG

  • Define utterances to trigger the intent.

utterances.PNG

  • Create new slot type and the values to fulfill the prompt.

slot_types.PNG

  • Define a prompt for the intent. Select the created slot type (ExerciseMode) for this prompt.

prompt.PNG

  • Create another slot type and prompt to make the conversation more meaningful.

slot_types_2.PNG

prompt_2.PNG

  • Define confirmation prompt. This is to handle make a conclusion based on overall user input and proceed to the fulfillment section (means to complete the intent). You can define response for both 'Yes' and 'No' from user's reply. You can make a confirmation by getting user input based on Slot Type.

confirmation.PNG

confirmation_yes.PNG

  • Define fulfillment to complete the intent. You can trigger a Lambda function in this section or use the provided response.

fulfillment.PNG

  • Done! Click Save Intent and Build the test bot in order to conduct a testing.

  • Test the chatbot.

Note: You can create another Welcome intent to greet the user before starting the conversation. [Create Intent -> Define Utterances -> Define Fulfillment Response]

chatbot.jpeg

That's all of my sharing regarding introduction and implementation of Amazon Lex in creating a simple chatbot. Next, I would like to share about integration of Amazon Lex with AWS Lambda to customize the business logic in the next article.

Feel free to comment if any idea! :)

Reference: Amazon Lex Documentation | Amazon Lex with AWS Lambda

 
Share this