I'll send a pro-active message from a bot to Microsoft Teams with 2 suggested actions that the user can take. But in Microsoft Teams the message is shown like this:

Notice that the message shows no suggested messages! At the Bot Framework Emulator, the same message looks like this:

What's wrong in Teams or my code?
Below is my code to authenticate, generate and send the message:
private async Task BotCallback(ITurnContext turnContext, CancellationToken cancellationToken)
{
string serviceUrl = turnContext.Activity.RelatesTo.ServiceUrl;
ConnectorClient Connector = new ConnectorClient(
new Uri(serviceUrl),
microsoftAppId: "[MicrosoftAppId]",
microsoftAppPassword: "[MicrosoftAppPassword]"
);
AppCredentials.TrustServiceUrl(serviceUrl);
ChannelAccount from = turnContext.Activity.From;
IMessageActivity activity = MessageFactory.SuggestedActions(
new string[] { "First action", "Second action" },
$"Hi {userName},\r\nYou've missed some lorem ipsum dolor sit amet:\r\n- **consectetur:** Ut porttitor\r\nChoose an action from below to add them."
);
await Connector.Conversations.SendToConversationAsync(
turnContext.Activity.Conversation.Id,
activity as Activity,
cancellationToken
);
}
Suggested actions are not supported in Teams. If you want to display buttons, you could use Cards in Teams.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With