Is the Bot Framework Emulator handling new members differently from Bot Framework Webchat?

给你一囗甜甜゛ 提交于 2019-12-11 10:14:36

问题


According to this official sample project (https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/typescript_nodejs/13.core-bot/src/bots/dialogAndWelcomeBot.ts) I can identity new members and send them a welcome message using this (my code):

this.onMembersAdded(async (context) => {
   const welcomeCardTemplate = require("../lib/data/resources/cards/welcomeCard.json");
      const membersAdded = context.activity.membersAdded;
      for (const member of membersAdded) {
         if (member.id !== context.activity.recipient.id) {
            const welcomeCard = CardFactory.adaptiveCard(welcomeCardTemplate );
            await context.sendActivity({ attachments: [welcomeCard] });
         }
      }
   });

It works great when using the emulator. As soon as I connect to the chat I get my welcome message, but when using the Chat on Azure or the WebChat it's not triggered until I first enter some kind of text input to the chat.

One thing I noticed is that when I'm using the emulator two activities are sent to the bot as soon as I connect to the chat, one that contains the Id of the bot and one that contains the Id of the user but when using the other chat options (Azure Chat and WebChat) only one activity is being sent (where the memberId is the same as the recipientId) so it never goes past the if-statement.

What am I missing here, why is only one activity being sent from the Azure Chat and WebChat?


回答1:


At this time, WebChat and DirectLine behaves differently from the emulator in certain scenarios like the one you describe. There is an open issue for this particular situation where you can find more information.

As stated in the issue, there is a workaround to force the ConversationUpdate event which you can try and test if it suits your needs (I haven't tried myself).



来源:https://stackoverflow.com/questions/56056885/is-the-bot-framework-emulator-handling-new-members-differently-from-bot-framewor

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