问题
I am in learning stage of node.js and BotFramework-WebChat.
I have a simple Dialogflow project and I have installed BotFramework-Webchat..
I need to trigger Dialogflow's "WELCOME" event after bot initialized?
I have read and followed the article on https://blog.botframework.com/2018/07/12/how-to-properly-send-a-greeting-message-and-common-issues-from-customers/
I found samples/backchannel of Microsoft/BotFramework-WebChat
I thought I can use it for starting to learn it.
but because of my limitation know how of Node.js, I don't know how to send message event triggering to Dialogflow to trigger its WELCOME event.
could any body please help me?
=== /home/BotFramework-WebChat-master/samples/backchannel/index.html ===
const botConnection = new BotChat.DirectLine({
domain: params['domain'],
secret: params['s'],
token: params['t'],
webSocket: params['webSocket'] && params['webSocket'] === 'true' // defaults to true
});
BotChat.App({
bot: bot,
botConnection: botConnection,
// locale: 'es-es', // override locale to Spanish
user: user
}, document.getElementById('BotChatGoesHere'));
botConnection
.postActivity({
from: user,
name: 'requestWelcomeDialog',
type: 'event',
value: ''
})
.subscribe(function (id) {
console.log('"trigger requestWelcomeDialog" sent');
});
botConnection.activity$
.filter(function (activity) {
return activity.type === 'event' && activity.name === 'requestWelcomeDialog';
})
.subscribe(function (activity) {
console.log('"activity" received with value: ' + activity.value);
});
来源:https://stackoverflow.com/questions/52215072/how-to-trigger-dialogflows-welcome-event-after-bot-initialized