图片附件未显示在 Facebook Messenger 中

问题描述

我正在使用 Microsoft Bot Framework 为 Messenger 频道开发 C# 机器人,我的问题是机器人应该将图像作为附件发送,我将 json 附件保存在频道数据中,如下面的代码所示。

public async Task SendAttachmentAsync(BotAnswer answer,ITurnContext turnContext,CancellationToken cancellationToken)
{
    var reply = turnContext.Activity.CreateReply();
    reply.ChannelData = JObject.FromObject(new
    {
        attachment = new List<AnswerAttachment> { answer.AnswerAttachment },});
}

public class AnswerAttachment
{
    [JsonProperty("type")]
    public string type { get; set; }

    [JsonProperty("payload")]
    public dynamic payload { get; set; }
}

public class Payload
{
    [JsonProperty("url")]
    public string url { get; set; }

    [JsonProperty("is_reusable")]
    public bool is_reusable { get; set; }
}

在模拟器中,您可以看到通道数据部分具有此图像的值。我检查图像是否存在于 url 中并满足 facebook api ( 的要求

emulator_test.png

到目前为止,一切正常,但是当我测试 Messenger 频道时,图像没有显示在聊天中。

messenger_channel_test.jpg

我应该怎么做才能解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)