Diego
Diego

Reputation: 357

Bot Builder v4: 'BadRequest' in SendActivityAsync()

I have a bot based in Echo bot (csharp_dotnetcore samples), running and reachable from Teams client. I tried to send a simple Card (from Cards Bot) after the 'echo', but I get a 'BadRequest' error... What can be wrong?

My code:

protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
    // OK
    await turnContext.SendActivityAsync(MessageFactory.Text($"Echo1: {turnContext.Activity.Text}"), cancellationToken);

    // 'BAD REQUEST'
    var attachments = new List<Attachment>();
    var message = MessageFactory.Attachment(attachments);
    message.Attachments.Add(GetAnimationCard().ToAttachment());
    await turnContext.SendActivityAsync(message, cancellationToken);
}

public static AnimationCard GetAnimationCard()
{
    var animationCard = new AnimationCard
    {
        Title = "Microsoft Bot Framework",
        Subtitle = "Animation Card",
        Image = new ThumbnailUrl
        {
            Url = "https://learn.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png",
        },
        Media = new List<MediaUrl>
        {
            new MediaUrl()
            {
                Url = "http://i.giphy.com/Ki55RUbOV5njy.gif",
            },
        },
    };

    return animationCard;
}

Thanks,

Diego

Upvotes: 0

Views: 352

Answers (1)

Trinetra-MSFT
Trinetra-MSFT

Reputation: 1015

Animation card is not supported in Teams. Please take a look at Card Reference for supported cards in teams.

Upvotes: 2

Related Questions