-
-
Save soltrinox/47e4374a2dc69fb8ec7037fe7afdf3ae to your computer and use it in GitHub Desktop.
Using the Lex postText API with AWS Node.js SDK
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
var AWS = require('aws-sdk'); | |
AWS.config.update({region: 'us-east-1'}); | |
var lexruntime = new AWS.LexRuntime(); | |
var params = { | |
botAlias: '$LATEST', /* required, has to be '$LATEST' */ | |
botName: 'BOT', /* required, the name of you bot */ | |
inputText: 'TEXT', /* required, your text */ | |
userId: 'USER', /* required, arbitrary identifier */ | |
sessionAttributes: { | |
someKey: 'STRING_VALUE', | |
/* anotherKey: ... */ | |
} | |
}; | |
lexruntime.postText(params, function(err, data) { | |
if (err) console.log(err, err.stack); // an error occurred | |
else console.log(data); // successful response | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment