AWS LEX - Developing a Simple Chat Bot
What are Chat Bots?
- Chat Bot is a service that runs on rules or Artificial intelligence
- The users interact using natural and conversational Language.
- Chat Bots are like your personal assistants that actually assist you.
- They can live in any chat applications like Slack, Facebook messenger, Skype etc.
- Common example: Weather Bots - fetches forecast, current weather etc.
- Lex (Amazon Web Services)
- Api.ai (Google)
- Azure Bot Service (Microsoft)
- Wit.ai (Facebook)
- Watson (IBM)
What is AWS Lex?
Lex is AWS service for building conversational interfaces for any applications using voice and text.
Lex enables you to build sophisticated, natural language Chat Bots into your new and existing applications. Lex can serve a variety of use cases, customer support, transaction fulfillment, data retrieval, or even DevOps functions (ChatOps).
AWS Lambda : Lex is integrated with AWS Lambda, a service that lets you run code without provisioning or managing servers. Lambda can be used as a Code Hook and also can be used to connect with other AWS services like SES, SNS, S3.
Prerequisites of Building a chat bot on AWS platform:
- AWS account
- Knowledge of any one of the languages (Node JS, Python, Java)
- Basic knowledge of Artificial Intelligence
Simple Chat Bot - Chat Bot to get details of any State in IndiaStep 1: Go to Lex in AWS management console and click on Create
Step 2: Choose the "Custom Bot" and fill details like Bot name, Language, Output Voice.
Step 3: Customize your Bot using Lex Console
Lex Console has following things by which a Chat Bot can be built:
- Adding Utterances: Requests from users is called utterances. Example: I want to Order some flowers or Get my state details.
- Create an Intent: An action that the user wants to perform, with the minimum information needed. Intent Name should be Unique. Example: OrderFlowers or GetMyStateDetails
- Create Slot Types: Slot Types are basically parameter values which are used in the Intent. Lex provides both Custom and Built In slot types. Example: AMAZON.DATE for Date format, or custom slot for CAR TYPES with Enumerations
- Confirmation Prompt: It confirms with a final prompt whether the user want to proceed with the action or not. It accepts 'Yes' or 'NO' as input from User. Terminates the fulfillment if user replies 'No'.
- Fulfillment: Fulfillment can be done in two ways: Either invoke a Lambda function or return the parameters back.
Lambda function for our Example here:
Build and test your Bot:
Here it is, your Bot is Ready!