Created
April 8, 2020 00:10
-
-
Save nivleshc/e6e8efde3a38b7eb170457b2036ae682 to your computer and use it in GitHub Desktop.
This file contains modifications that must be done to the lifeinsurancebot.html file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize the Amazon Cognito credentials provider | |
AWS.config.region = 'us-east-1'; // Region | |
AWS.config.credentials = new AWS.CognitoIdentityCredentials({ | |
// Provide your Pool Id here | |
IdentityPoolId: 'us-east-1:XXXXX', | |
}); | |
var lexruntime = new AWS.LexRuntime(); | |
var lexUserId = 'chatbot-demo' + Date.now(); | |
var sessionAttributes = {}; | |
function pushChat() { | |
// if there is text to be sent... | |
var wisdomText = document.getElementById('wisdom'); | |
if (wisdomText && wisdomText.value && wisdomText.value.trim().length > 0) { | |
// disable input to show we're sending it | |
var wisdom = wisdomText.value.trim(); | |
wisdomText.value = '...'; | |
wisdomText.locked = true; | |
// send it to the Lex runtime | |
var params = { | |
botAlias: '$LATEST', | |
botName: 'BookTrip', | |
inputText: wisdom, | |
userId: lexUserId, | |
sessionAttributes: sessionAttributes | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment