Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
When sending an Adaptive card via bot builder framework, it only shows "Sent a card" as the message, in iPhone. The bug seems to be caused by the ampersand character &. See screenshot below in "Screenshot" section.
To Reproduce
Steps to reproduce the behavior:
Bot message should be sent in the context of a custom Teams app, and will appear inside Chat/Activity tab of the custom Teams app. Code instructions below:
Create "Activity" object.
Populate ServiceUrl, Type, Summary.
Populate Attachments with HeroCard. HeroCard "Message" property should have ampersand character &.
Send Activity via turnContext.SendActivityAsync()
Open the Teams bot message inside an iPhone (Chat/Activity tab of the custom Teams app).
Code below in "Additional Context" section.
Expected behavior
MessageText should be shown correctly on iPhone (instead of "Sent a card"). It's working correctly on Android and PC.
Screenshots
Screenshot below that shows a working message on Android (left side) and incorrect message for iPhone (right side).
Additional context
Code to reproduce the issue:
public async Task<string> Send(ITurnContext turnContext, string messageText, CancellationToken cancellationToken = default)
{
if (!turnContext.Activity.IsTeamsBot())
{
throw new BotException($"{turnContext.Activity.ChannelId} channel is not supported for this kind of bot messages.");
}
var campaignLaunchMessageActivity = new Activity();
campaignLaunchMessageActivity.ServiceUrl = turnContext.Activity.ServiceUrl;
campaignLaunchMessageActivity.Type = ActivityTypes.Message;
campaignLaunchMessageActivity.Summary = messageText.StripHTML();
campaignLaunchMessageActivity.Attachments = new List<Attachment>
{
new HeroCard
{
Text = messageText,
}.ToAttachment(),
};
var response = await turnContext.SendActivityAsync(campaignLaunchMessageActivity, cancellationToken);
return response.Id;
}
Version
4.11.1.0
Describe the bug
When sending an Adaptive card via bot builder framework, it only shows "Sent a card" as the message, in iPhone. The bug seems to be caused by the ampersand character
&
. See screenshot below in "Screenshot" section.To Reproduce
Steps to reproduce the behavior:
&
.turnContext.SendActivityAsync()
Expected behavior
MessageText should be shown correctly on iPhone (instead of "Sent a card"). It's working correctly on Android and PC.
Screenshots
Screenshot below that shows a working message on Android (left side) and incorrect message for iPhone (right side).
Additional context
Code to reproduce the issue: