Skip to content

Instantly share code, notes, and snippets.

@gittimos gittimos/api.js
Last active May 13, 2017

Embed
What would you like to do?
Using the AWS Lex API with the AWS SDK
let AWS = require('aws-sdk')
let credentials = new AWS.SharedIniFileCredentials({profile: 'default'});
AWS.config.credentials = credentials;
AWS.config.update({region: 'us-east-1'});
let lexruntime = new AWS.LexRuntime({
apiVersion: '2016-11-28',
});
let params = {
botAlias: '$LATEST', /* required */
botName: 'BookTrip', /* required */
inputText: 'I want a make hotel reservations', /* required */
userId: '4o9s3dhx6nlhe038dbn3s3fujd3118f5w', /* required */
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
You can’t perform that action at this time.