Create your own ChatBot by using Amazon Lex and Lambda

First of all tell you about, what is a ChatBot?

Chatbot is the set of computer program or AI(artificial intelligence) which conducts communication between two or more users in form of voice or text messages.

This tutorial will tell you how to create your own Chatbot by using AWS Lex and Lambda function and also includes steps to integrate the chatbot with Facebook messenger.

Creating chatbot requires AWS account and basic programming skills with little knowledge of AI.

Amazon Lex

You need to login AWS Console site to open Amazon Lex service to create Chatbot.

Here i’m creating simple financial Chatbot which is suggest the customer to buy the best mutual fund based on your input.

Go to Amazon Lex site for create a custom bot, give some name of bot and choose output voice type and create bot.

Now you have to create custom Intents which is using for your i gave intent name is Mutul fund. you can give any name for your requirment.

Let’s tell about some basic terms which is used to inside in AWS Lex. An intents is used to fulfills a user’s responses through chatbot for certain messages. Slots have a list of values which is used by intents.Sample Utterance is similar way to training the chatbot for giving user inputs. eg. “Hi”, “Hello”, “Hey” like that. Create Custom Slots for value and giving some Sample utterances.

Like that you have to create three more slots are FinName,FinOrderType,FinBuy. In every have to give some prompts messages for responses based on slots orders.

Before Lambda initialization and validation have to create Lambda function. Go to AWS Console home page and select Lambda inside compute service. then create lambda function for select the Author from scratch option. and choose Run time programming language which you want to use it, choose an existing role in Role columns then click to create function button.

Edit the index.js file and pasted the link code. AWS Lambda code for node.js and save it function.

Now again come to AWS Lex page where you created bot, click on Lambda initialization and validation option and checked the checkbox then selected the Lambda function.

and give some confirmation message for confirming the last transaction/communication of your chatbot. Then build your project and tested. if its is working fine then published your project.

Demo Video:

In next post will show, how to publish Lex project in Facebook messenger.

If you ‘ve any suggestion/issue regarding above post, Please let’s comments it.