Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#6086] Teams is adding support for suggested actions in 1-1 chats #6607

Merged
merged 3 commits into from
May 16, 2023

Conversation

ceciliaavila
Copy link
Collaborator

Fixes #6086

Description

This PR enables Suggested Actions for MSTeams in Dialogs Prompts and Adaptive Dialogs Inputs.

Specific Changes

  • Updated ChoiceInput , ConfirmInput , ChoicePrompt, and ConfirmPrompt classes to pass to the AppendChoices method the conversationType and the list of recipient's ids, necessary to send suggested actions in the MSTeams channel.
  • Updated AppendChoices method in InputDialog and Prompt overloading it to receive the new parameters conversationType and toList and pass them to the ForChannel method.
  • Updated SupportsSuggestedActions method in Channel class to include the MSTeams channel in the switch case.
  • Overloaded the ForChannel method in ChoiceFactory and the SuggestedActions method of the MessageFactory to add the new parameters conversationType and toList.
  • Added unit tests in ChoiceFactoryTests and ChoiceChannelTests test classes.
  • Updated MessageFactoryTests to disambiguate the calls to SuggestedActions.

Testing

These images show how MSTeams displays the choices in a group chat (hero card) and in a personal chat (suggested actions).
image

@ceciliaavila ceciliaavila added the Automation: Parity with js The PR needs to be ported to JS label Mar 27, 2023
@ceciliaavila ceciliaavila requested a review from a team as a code owner March 27, 2023 16:00
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 345709

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 61 unchanged lines in 9 files lost coverage.
  • Overall coverage decreased (-0.04%) to 79.067%

Files with Coverage Reduction New Missed Lines %
/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/Prompt.cs 1 86.36%
/libraries/Microsoft.Bot.Streaming/Payloads/StreamManager.cs 1 90.0%
/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/ChoiceInput.cs 5 72.84%
/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/ConfirmPrompt.cs 5 88.06%
/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/ConfirmInput.cs 6 83.12%
/libraries/Microsoft.Bot.Builder.Dialogs/Prompts/ChoicePrompt.cs 6 78.18%
/libraries/Microsoft.Bot.Builder/MessageFactory.cs 6 87.23%
/libraries/Microsoft.Bot.Builder.Dialogs/Choices/ChoiceFactory.cs 15 81.52%
/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/InputDialog.cs 16 86.39%
Totals Coverage Status
Change from base Build 344537: -0.04%
Covered Lines: 25821
Relevant Lines: 32657

💛 - Coveralls

@BruceHaley
Copy link
Contributor

✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.dll
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Dialogs.dll

@limamicro
Copy link

Hi @ceciliaavila, can you give me the sample code of the bot reply logic, as well as the manifest file?
I try to reproduce your changes to verify the behavior, but I could not see the expected behavior as you attached in Testing result.
Thanks!

@limamicro
Copy link

@ceciliaavila regarding the changes, right now suggested actions is only available 1:1 scope. All suggested actions sent to group chat and channels should be dropped instead of supporting that. Can you help me to understand more why you make these changes?

@ceciliaavila
Copy link
Collaborator Author

ceciliaavila commented Apr 20, 2023

Hi @limamicro,
Teams support suggested actions only in 1:1 chats.
The SDK should construct a card with suggested actions whenever possible. For other types of conversations, it defaults to a hero card with options (Per @EricDahlvang suggestion in #6086).

I'm attaching the sample used to test these changes.
57.teams-conversation-bot.zip

@limamicro
Copy link

Hi @ceciliaavila I tested with your bot and went through the code. Your changes look good for me for the Suggested Actions part. For the Dialog in general, since I am not very familiar with the details, I asks Kavin to help with another pair of eyes. Thanks for the update!

Copy link

@limamicro limamicro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes related to suggested actions look good for me. Please wait for another approval from whom is familiar with the Dialog process before submitting the code. Thanks!

case Connector.Channels.Msteams:
if (conversationType == "personal")
{
return buttonCnt <= 3;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why there is a limitation on 3 buttons? Is it a limitation on 1:1 suggested actions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ceciliaavila, if this is a designed limitation for SA, do we need to document it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Teams display up to three suggested actions. I added the link to the documentation in the code.

@tracyboehrer tracyboehrer merged commit 5549586 into main May 16, 2023
@tracyboehrer tracyboehrer deleted the southworks/add/teams-suggested-actions-support branch May 16, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation: Parity with js The PR needs to be ported to JS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Teams is adding support for suggested actions in 1-1 chats
6 participants