I would like to send a default message at begining of the dialog, before the user types anything, so I was using something like
// on dialog begin
self.dialog.onBegin(function (session, args, next) {
if (!session.userData.firstRun) {
// Send the user through the first run experience
session.userData.firstRun = true;
session.beginDialog('/');
session.send( self.getLocalizedString('RESPONSE_BEGIN_WELCOME','RESPONSE_BEGIN_WELCOME') );
} else {
next();
}
});
The problem is that the dialog.onBegin starts only after the user types in something (or a simple \r\n), while my aim was just to print a default welcome message everytime a user join the bot session.
i have the same question
By before they type anything do you mean when the user is added to a conversation? We have events for that and you can configure the welcome message to send as a parameter on the BotConnectorBot.
@Stevenic yes exactly, I do like
// begin actions
// on dialog begin
self.dialog.onBegin(function (session, args, next) {
if (!session.userData.firstRun) {
// Send the user through the first run experience
session.userData.firstRun = true;
session.beginDialog('/');
//session.send( self.getLocalizedString('RESPONSE_BEGIN_WELCOME','RESPONSE_BEGIN_WELCOME') );
} else {
next();
}
});
// default actions
self.dialog.onDefault(
[waterfallsOnDefaultStep1, waterfallsOnDefaultStep2]
}
// add dialog model
self.bot.add('/', self.dialog);
So when the bot starts (using LUIS model), it does nothing then waiting stdin. As soon as I type in something or carriage return, the onBegin will do session.send.
So I guess, I have to intercept some new event as you explained.
So the only way to automatically send a welcome message right now (before the user types) is by configuring a static one. See below for an example of this.
var bot = new builder.BotConnectorBot({
appId: process.env.BOTFRAMEWORK_APPID,
appSecret: process.env.BOTFRAMEWORK_APPSECRET,
groupWelcomeMessage: 'Group Welcome Message Works!',
userWelcomeMessage: 'User Welcome Message Works!',
goodbyeMessage: 'Goodbye Message Works!'
});
@Stevenic will this works with TexBot as well?
bot = new BotBuilder.TextBot();
No... TextBot doesn't understand greetings. I could potentially make that work
Hi,
Is there an example of this scenario using the newer UniversalBot and ChatConnector?
Jarrod
Most helpful comment
Hi,
Is there an example of this scenario using the newer UniversalBot and ChatConnector?
Jarrod