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

Adaptive card sent by bot builder framework only shows "Sent a card" as the message, in iPhone #6774

Open
hussain-nz opened this issue Apr 11, 2024 · 0 comments
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.

Comments

@hussain-nz
Copy link

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:

  1. 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:
  2. Create "Activity" object.
  3. Populate ServiceUrl, Type, Summary.
  4. Populate Attachments with HeroCard. HeroCard "Message" property should have ampersand character &.
  5. Send Activity via turnContext.SendActivityAsync()
  6. Open the Teams bot message inside an iPhone (Chat/Activity tab of the custom Teams app).
  7. 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).
image

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;
    }
@hussain-nz hussain-nz added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.
Projects
None yet
Development

No branches or pull requests

1 participant