Reputation: 5
Hi I am looking for the code where I can read the user utterance in the dialog and find entity to execute business logic. I am using RegEx recognizer instead of LUIS. I am able to invoke the proper intent with user input. The below is code
bot.recognizer(new builder.RegExpRecognizer( 'searchProductsIntent', /^search products in \w+$|^please get products of \w+$/i));
bot.dialog("searchProductsKk", function (session) {
session.send("I am intent");
session.endConversation("Ok, I'm intent.");
//Logic:I want to read the user utterance here for eg., search products in **kodak**. I want to read the search term "kodak" from utterance to search kodak products.
}).triggerAction({ matches: 'searchProductsIntent' });
I couldn't find related sample code anywhere.
Upvotes: 0
Views: 94
Reputation: 13918
You can recieve the input message via the second parameter of IDialogWaterfallStep
function. Please consider the following code snippet:
bot.dialog("searchProductsKk", function (session,args,next) {
// args.intent.matched[0] is the user utterance.
console.log(args.intent.matched[0])
}).triggerAction({
matches: 'searchProductsIntent'
});
Upvotes: 1