Is it possible to to display a welcome message in a standalone bot (Node.js)? I would like to have the intent in the builder and invoke in my lambda function or from the front end node app. From the docs i can see that it can be done with postText() or postContent() but not sure how to implement or the best way to go about it.
Edit: The bot is launched from a node app into an iframe whìch then calls the lex api. Based on user input a slot value is returned from lex or from the lambda function.
You can make an intent
with some name (lets say Welcome
), give some utterance which will be used to invoke the intent
(lets say welcome to chatbot
).
Then in your web app onPageLoad
you can use PostText function in AWS-SDK
to send the exact same utterance.
var params = {
botAlias: 'alias_of_your_bot',
botName: 'name_of_your_bot',
inputText: 'welcome to chatbot',
userId: 'some_user_id',
};
lexruntime.postText(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});
Hope it helps.