OfficeDev / microsoft-teams-faqplusplus-app

DEPRECATED - This repository contains a deprecated version of the FAQ Plus app template. Please see the README file for more details and a link to the new repository
MIT License
48 stars 49 forks source link

Web chat wont crawl QnA database #83

Closed zagora4 closed 4 years ago

zagora4 commented 4 years ago

Hi,

I just deployed template and I playing around with it. This is not a issue, perhaps is specific with my installation. Can you help me with following issue: web chat in Azure or in botframework don't work. Otherwise, FAQ Plus works just fine in MS Teams.

Edit: Just found here that FAQ Plus is designed to work only in MS Teams. Pls ignore request if solution does not exists.

Many thanks!

GeorgianaMihaela commented 4 years ago

Hello @zagora4

The bot does not reply in webchat/emulator because:

The main bot class (FaqPlusPlusBot.cs) has a few conditions verifying the specific conversation type: In OnMessageActivityAsync method: switch (message.Conversation.ConversationType) { case "personal”: await this.OnMessageActivityInPersonalChatAsync(message, turnContext, cancellationToken); break; case “channel”:

In webchat/emulator, this switch executes the default branch because the conversation type is null (message.Conversation.ConversationType). In Teams, this is either "personal" or "channel", so the switch executes ones of the branches.

Teams docs: https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bot-conversations/bots-conv-channel https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bot-conversations/bots-conversations

You could discover this by debugging the code in the emulator https://docs.microsoft.com/en-us/azure/bot-service/bot-service-debug-emulator?view=azure-bot-service-4.0&tabs=csharp#connect-to-a-bot-running-on-localhost

Place a breakpoint in the OnMessageActivityAsync (FaqPlusPlusBot.cs) (https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.activityhandler.onmessageactivityasync?view=botbuilder-dotnet-stable) and step into the execution flow.

I hope this helps.

zagora4 commented 4 years ago

Many thanks!