我想在Facebook Messenger上发送带有按钮的旋转木马。
如何设置Microsoft Bot Framework中表单生成的附件的 ContentUrl 和 ContentType ?
我可以在创建Message对象时手动执行此操作:
C# Code, JSON Response and Messenger
var reply = message.CreateReplyMessage();
reply.Attachments = new List<Attachment>();
var actions = new List<Microsoft.Bot.Connector.Action>();
actions.Add(new Microsoft.Bot.Connector.Action
{
Title = "Small",
Image = @"https://upload.wikimedia.org/wikipedia/en/a/a6/Bender_Rodriguez.png",
Message = "Small"
});
actions.Add(new Microsoft.Bot.Connector.Action
{
Title = "Large",
Image = @"https://upload.wikimedia.org/wikipedia/en/a/a6/Bender_Rodriguez.png",
Message = "Large"
});
reply.Attachments.Add(new Attachment
{
Title = "Flat White",
Actions = actions,
ContentUrl = @"http://imgur.com/XbCCntC.png",
ContentType = "image/png"
});
但是在使用表格时我不知道该怎么做。我可以使用 DescribeAttribute 来设置Action的Image URL,它显示在JSON响应中。
但是这不会显示/显示任何内容,我认为图像需要成为Attachment对象的一部分,而不是Action。
Partial C# Code, JSON Response and Messenger
public enum WhiteStyle
{
Invalid = 0,
[Describe(Image = @"http://imgur.com/XbCCntC.png")]
FlatWhite,
[Describe(Image = @"http://imgur.com/qbbi6yc.png")]
Latte,
[Describe(Image = @"http://imgur.com/sF95Vsc.png")]
Cappuccino
}