how to trigger Dialogflow's “WELCOME” event after bot initialized

时间秒杀一切 提交于 2019-12-11 15:57:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!