My Amazon Lex is hosted on a website. Users are logged into the website and I have to pass their user token from the website to Lex or lambda. The bot is embedded in the website using CloudFormation code snippet. Where and how do I set the parameters to pass into Lex from the website and how do I receive them in Lambda?
3
votes
1 Answers
2
votes
How to pass a session attribute when configured with https://aws.amazon.com/blogs/machine-learning/deploy-a-web-ui-for-your-chatbot/
1. In the S3 bucket, modify the JSON config file. You can do this by downloading and then editing locally. Re-upload and load the latest version.
1.1. Modifications should look like this
"lex": {
"botName": "Chatbot",
"botAlias": "$LATEST",
"sessionAttributes": {
"anything": "testtoken"
},
"initialText": "blah blah blah",
"initialSpeechInstruction": "Say 'Buy Flowers' to get started.",
"reInitSessionAttributesOnRestart": false
},
1.2. Make sure there is public access to read JSON
2. follow this: https://github.com/aws-samples/aws-lex-web-ui/issues/63
Note - parameters are stored as session attributes in Lex. They can easily be stored in dynamo through Lex/Lambda or invoking a lambda in the browser.