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
- Intent: User's intention as in what user is going to do with this chatbot (Eg: Room booking? Hotel reservation?).
- Utterances: Phrases that will trigger the intents (Eg: I want to book a room / I want to make a hotel reservation).
- Prompt: Question that ask user to input the required slot (Eg: What is the preferable type of bed?).
- 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).
- 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
- User Input Validation: The business logic to start the conversation in a specific intent.
- Intent Fulfillment: The business logic to end the conversation in a specific intent.
- Create an intent and define the intent name.
- Define utterances to trigger the intent.
- Create new slot type and the values to fulfill the prompt.
- Define a prompt for the intent. Select the created slot type (ExerciseMode) for this prompt.
- Create another slot type and prompt to make the conversation more meaningful.
- 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.
- Define fulfillment to complete the intent. You can trigger a Lambda function in this section or use the provided response.
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]
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! :)