Botbuilder-dotnet: Suggested action buttons not rendered on Microsoft Teams

Created on 20 Aug 2019  路  13Comments  路  Source: microsoft/botbuilder-dotnet

Version

4.5.1

Describe the bug

Suggested actions message activity attachment does not render the buttons on Microsoft Teams

To Reproduce

Steps to reproduce the behavior:

  1. Register the bot with Microsoft Teams channel
  2. Send a message with "Suggested Actions" activity attached to the message

Expected behavior

See suggested action button rendered in Microsoft Teams application. Same behavior as Microsoft Bot Framework web chat canvas.

Screenshots

image

Additional context

Microsoft Teams documentation indicates suggested actions is not supported and needs to be provided as a hero card. We are expecting Azure Bot Service to provide the translation from suggested actions to hero cards on Microsoft Teams.

investigate

All 13 comments

I've reached out to the PM from Teams, to get more detail around this behavior.

Hello @mkchow, I am happy to help!

It is true that Microsoft Teams does not support suggested actions. I am noticing a discrepancy in your issue because your expected behavior section says you expect Microsoft Teams to display suggested actions like Web Chat does, but your additional context section says you expect the Azure Bot Service to convert suggested actions to hero cards. Can you clarify what your expectation is?

If you expect Microsoft Teams to render actual suggested actions like Web Chat, is there any documentation that led you to believe that suggested actions should render on Microsoft Teams?

There are currently no channel connectors that perform an automatic conversion between suggested actions and hero cards, so I am also curious to know if there is documentation that made you expect that behavior. It is up to the bot to differentiate between suggested actions and hero cards and send only the type of buttons it intends to send. Because cards and suggested actions are fundamentally different in that one persists in the conversation history while the other does not, it seems like it would be a bad idea to have the connector service perform automatic conversions between the two without having the bot explicitly put the type of button in its payload. However, if you would like to submit this as a DCR then I believe the Bot Framework SDK repo is the place for that. If you believe this is a bug in the Microsoft Teams connector service then that can be reported in the Bot Framework Services repo.

While you're here in the repo for the Bot Builder .NET SDK, I should mention that the SDK already contains the functionality you're looking for. If you use the static ChoiceFactory.ForChannel method then your bot can choose between hero cards and suggested actions easily and automatically.

Does this resolve your issue?

Here is the list of card actions supported on the Microsoft Teams channel. You are not limited to using Hero Cards:

https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/cards/cards-actions

@mkchow5928, it seems you have found the documentation regarding what is supported in Teams, as you mention at the bottom of the issue you originally filed.

image

As the Teams docs state, it's just a feature that they simply do not support. This is an issue specifically related to the Teams, and not the Bot Framework. If changes were to be made, it would have to be on the Teams' end.

Closing this issue out, as the links to doc specifies alternative cards that are supported in Teams

Thank you for the response. While we are aware that Teams does not support suggested actions, but we expect that Microsoft Bot Framework would automatically translate the suggested actions to a renderable experience in Microsoft Teams. It looks like there is an expectation miss alignment. Is the formal recommendation for bot developers to add our own business logic to do different UI rendering for each channel?

Hello @mkchow5928

The ChoiceFactory.ForChannel method handles the business logic and makes it easy for developers to display choices differently on different channels. I don't know that there's a formal recommendation, but the channel connector services do not perform any automatic conversion between suggested actions and cards so bot developers naturally have to handle that on their side. I am still curious to know if there's any documentation that led you to expect Teams to automatically convert suggested actions to a card.

am i getting correctly is that only way to have simple menu in teams is a) use ChoiceFactory.ForChannel (and it kinda eliminates whole facade function of framework) or b)use CardActions (which actually serves a bit another idea and looking whole other way from UX perspective?

@Unders0n - I'm not sure what you're asking. ChoiceFactory.ForChannel is meant to be used in situations where your bot is expected to communicate with multiple channels. If you want to have a simple menu in Teams, you can just create a card and send it to Teams any way you want. Card actions are part of the Bot Framework schema and are used in both Bot Framework cards and suggested actions. What do you mean by "which actually serves a bit another idea and looking whole other way from UX perspective" and "and it kinda eliminates whole facade function of framework"?

@v-kydela by "which actually serves a bit another idea and looking whole other way from UX perspective" i was actually referring to your own first answer "Because cards and suggested actions are fundamentally different in that one persists in the conversation history". And that's true - suggested actions (at least how they work in web chat and in many other platforms) are SIMPLE menu which only appears when asking , doesn not cover whole line etc. While Card actions (if done by default using docs) behave whole other way - they remains on the line after answer , gets much attention etc.
So my question is - we can't get SIMPLE behavior of suggested actions in ms teams? If yes - why? is that by default?
As for "it kinda eliminates whole facade function of framework" - i meant that ChoiceFactory.ForChannel is asking for specific platform (in 1st argument) so i need to write specific code for specific platform while i just need to simple menu be rendered on many channels ..which is kinda the purpose of framework and ecosystem. Mb i misunderstood usage?

@Unders0n - Again, card actions are part of the Bot Framework schema and are used in both Bot Framework cards and suggested actions. It doesn't make any sense to say "While Card actions (if done by default using docs) behave whole other way - they remains on the line after answer , gets much attention etc." When you say card actions, I think you just mean cards.

As we've said repeatedly, suggested actions are not supported on Teams so I'm not sure why you're still asking about that. I also don't know why you're repeatedly using the word "simple" to refer to suggested actions. It's arguable that suggested actions are more complicated than cards. While buttons in cards just perform an action, suggested actions both perform the action and automatically remove themselves from the UI.

i meant that ChoiceFactory.ForChannel is asking for specific platform (in 1st argument) so i need to write specific code for specific platform

That's incorrect. ChoiceFactory.ForChannel explicitly makes it so that you don't have to write specific code for specific platforms. The whole purpose of that method is to do it for you.

You are commenting on a closed issue. If you need help with something and you have a specific question, please make a post on Stack Overflow.

@v-kydela what's the point in being that rude? "repeatedly " , "repeatedly" , "still asking"? Really?! i've just made 1 small post with question and one post revealing what i've meant.
I was describing very trivial scenario - menu that disappear after selection. Scenario that is working out of the box in lot's platforms using suggested actions and surprisingly not working in default MS channel.

When you say card actions, I think you just mean cards.

I meant when for menu we're using CardAction class inside of HeroCard as attachment , i'm not aware of other options to solve this.

as for "simple" - specially for those who loves to carp to words i explained what i've meant right in the same sentence -

which only appears when asking , doesn't not cover whole line
.

That's incorrect. ChoiceFactory.ForChannel explicitly makes it so that you don't have to write specific

Sorry for "repeatedly" saying but ChoiceFactory.ForChannel's first mandatory argument is channel of Microsoft.Bot.Connector.Channels meaning you need to write SPECIFIC code block for SPECIFIC platform. Yes you may not need to write lowlevel payload for that but i still need to do if/else/switch and change arguments accrodingly while my aim is to just declaratively write that i need specific type of menu and want framework to translate that to closest supported behavior.

I know you as developer make lot's of work and developers thank you for that but please don't behave like a god and make some rescpect to developers that promotes framework and stack you're contributing to. Thanks for reading, will further write my questions to SO

@Unders0n - Please allow me to apologize for my unkind behavior. I would like to help, but it will be better to take questions to Stack Overflow as you've said.

@v-kydela thank you, apology accepted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EricDahlvang picture EricDahlvang  路  4Comments

drub0y picture drub0y  路  3Comments

EricDahlvang picture EricDahlvang  路  4Comments

brandonh-msft picture brandonh-msft  路  4Comments

lauren-mills picture lauren-mills  路  6Comments