I participated in the ARC328 - Creating a Support Chatbot of the builders session.
The builders session is a group session with AWS Solution Architect and five participants.
To quote the event catalog.
In this session, create a conversational interface with Amazon Lex which recognizes and answers common questions received through chat or voice. Become familiar with an Amazon Lex chatbot and its constructs, such as intents, utterances, and slots.
AWS services used this time:
- Amazon Lex
- AWS Lambda
- Amazon S3
We will present AWS's solution architect, and will build it according to the following documents:
Module 1: Static Web Hosting with Amazon S3
In this module, we host a static website on Amazon S3. We build this using CloudFormation.
- Type Website Bucket Name and click
- Select 'default' on the Options page and click
On the Review page, check the box next to I acknowledge that AWS CloudFormation might create IAM resources., and click
- After stack status becomes
CREATE_COMPLETE, we will click
- This completes Module 1.
Module 2: User Registration with Amazon Cognito User Pools
In this module, we create an Amazon Cognito User Pool user to log in.
- Go to
/register.htmland create an account.
- This redirects to
/verify.html. Type in the
verification codethat you receive in your email.
- Login after redirecting to
- This completes Module 2.
Module 3: Create Chat bot
In this module, we create a chatbot with Amazon Lex.
Step 1: Create the AWS Lambda function
We will create Lambda function using CloudFormation template. Proceed with all settings on default.
Step 2: Configure Cognito pool id in Lambda function
Here, we modify the Lambda function.
Cognito User Pool Idfrom
Resourceof CloudFormation stack
- Open the Lambda function(support-chatbot-function) that is created, modify
import json import boto3 client = boto3.client('cognito-idp') with open('./response.json', 'r') as r: response = json.load(r) response_success = response['response_success'] response_fail = response['response_fail'] #use your cognito user pool ID PoolID = 'xxxxxxx'
Step 3: Creating your Bot
- Download json file prepared in advance. VirtualHelpDesk.zip
Go to Amazon Lex console.
Importthe zip file we downloaded earlier.
Buildto create a bot.
- When Build is completed, try typing
I forgot my passwordon the screen on the right.
Step 4: Integrating the bot with Lambda and test it
- Go to the
Fulfillmentsession, select the
Lambda functionwe just created and set
$LATEST. Keep the same settings for both intent,
Save Intentto save.
Buildto build the chatbot.
Step 5: Test Password Reset and Account Unlock Intent
- In the
Test botand type
I forgot my password.
We will follow the chatbot's support instructions. At the end, you will see the following response, and the reset code is sent to the email address.
Great, you're all set. Check your email for further instructions.
- When we receive the email, go to
/forgotPassword.htmland reset the password.
- After resetting the password, move to
/signin.htmland login with the new password.
- Test with the
From Cognito's management console, change Cognito User Pool(SupportChatbot) →
Users and Groups→ user to
UnlockAccountintent and type
I think my account is locked.
Follow the chatbot's support instructions. At the end, you will see the following response, which unlocks the user.
Great, you're all set. Try logging in now
At this point we can confirm that
Account Status is
- Go to
/signin.htmland check if login is possible.
Step 6: Host the bot with-in a Web Application
Launch the CloudFormation stack.
- In the Lex Bot Configuration Parameters, type BotName :
- In the Web Application Parameters, type each of the parameters.
Hello, How can I help you?
I forgot my password
- When Stack status becomes
ParentPageURl, the chatbot will be displayed as
I plan to use chatbots more often from now on. please see the details of github's aws-samples/support-chat-bot. I am eagerly waiting for Amazon Lex's Japanese language response, which I will study in detail.