Prompts not showing in in microsoft Teams integrated bot

醉酒当歌 提交于 2021-01-27 20:10:14

问题


I created bot using QnaMaker.ai service and Microsoft azure services.It's working fine with webchat channel.Now i integrated it with Microsoft Team channel and that's where i got into a problem. The prompts that were working in webchat channel are not working same in Teams channel. Like for question i showed 4 options to select.But in microsoft teams they are Bot in webchat channel and bot in Teams


回答1:


Are you trying to show Suggested Actions? Suggested actions are not supported in Microsoft Teams. if you want buttons to appear on a Teams bot message, please try using cards. Please let us know if you need any further assistance.




回答2:


You can use ChoiceFactory.toChoices in Teams and it will work. I prefer this method because it's simple (all you need is the array of choices as strings) and it works, but you can also use ChoiceFactory.forChannel which should automatically format the choices for ANY channel. Here is an example from one of the bots I use in Teams, where the buttons display fine. This is nodejs but the same class will work in C#.

        FOCUS_AREAS = ['Chatbots','RPA','Blockchain','AR/VR','AI & ML'];
        return await step.prompt(FOCUS_AREA_PROMPT, {
            prompt: 'Which focus area is this for?',
            choices: ChoiceFactory.toChoices(FOCUS_AREAS)
        });

Reference from Microsoft: https://docs.microsoft.com/en-us/javascript/api/botbuilder-dialogs/choicefactory?view=botbuilder-ts-latest

Examples: Here is the output from the code above. The total length is too long to render as buttons in Teams channel, so it has automatically switched to a numbered list.

The below uses the same exact ChoiceFactory.toChoices implementation, just with fewer options so it renders as buttons instead of a numbered list.



来源:https://stackoverflow.com/questions/58178054/prompts-not-showing-in-in-microsoft-teams-integrated-bot

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