我正在构建一个连接到 GroupMe 频道的 Bot Framework 机器人。根据(非 Bot Framework 特定的)GroupMe Bot 教程,GroupMe 支持机器人发送图像或位置附件,通过发送具有以下语法的消息:
{ "bot_id" : "j5abcdefg", "text" : "Hello world", "attachments" : [ { "type" : "image", "url" : "https://i.groupme.com/somethingsomething.large" } ] }或者:
{ "bot_id" : "j5abcdefg", "text" : "Hello world", "attachments" : [ { "type" : "location", "lng" : "40.000", "lat" : "70.000", "name" : "GroupMe HQ" } ] }
我试图弄清楚如何从 Bot 框架发送一条消息,该消息将在由 Bot 连接器处理后映射到 GroupMe 端的这种附件格式。我试过以下代码:
var attachment = new Attachment();
attachment.Content = new
{
type = "location",
lng = 70.000,
lat = 40.000,
name = "GroupMe HQ"
};
await turnContext.SendActivityAsync(MessageFactory.Attachment(attachment, "Here's the location:"));
但是,在 GroupMe 聊天中收到消息时,附件似乎不存在。是否有任何受支持的方式可以从 Bot Framework SDK 发送这些附件?