I recently started development of a BOT application using Microsoft BOT framework with Node.js SDK. I want to know whether it's possible to check for a matching intent inside a dialog. For example,
var builder = require('botbuilder');
var bot = new builder.UniversalBot(connector);
var intents = new builder.IntentDialog();
bot.dialog('/', intents);
This intent will check for greetings.
intents.matchesAny([/^hi/i, /^hello/i], [
function (session) {
var displayName = session.message.user.name;
var firstName = displayName.substr(0, displayName.indexOf(' '));
session.send('Hello I’m M2C2! How can I help you %s? If you need help just say HELP.', firstName);
}
]);
This intent will match for check card balance.
intents.matchesAny([/^balance/i, /^card balance/i], [
function (session) {
session.beginDialog('/check-balance');
}
]);
And this is the dialog for check-balance.
bot.dialog('/check-balance', [
function (session) {
builder.Prompts.text(session, "Sure, I can find the balance for you! May I know the card number that you want to check the balance of?");
},
function (session, results) {
if (isNaN(results.response)) {
session.send('Invalid card number %s', results.response);
} else {
session.send('The balance on your %s card is $ 50', results.response);
}
session.endDialog();
}
]);
what I want to know is whether it's possible to check for any of the matching intent inside the check-balance dialog. Let's say user enters an invalid card number and I want to make sure that command is not match with any of the defined intents so that I can show invalid card number response for sure and if its match, execute the matching intent.
Prompts.text()it shouldn't be trying to match intents. If you are usingtriggerAction()however, any utterances that match its"matches"property will fire. - Steven G.