我有一个基于Echo机器人的机器人(csharp_dotnetcore示例),可以从Teams客户端运行并访问它。 我尝试在“回声”之后发送一个简单的Card(来自Cards Bot),但出现“ BadRequest”错误... 有什么问题吗?
我的代码:
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://docs.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;
}
谢谢
迭戈