Image attachments not showing up in Facebook Messenger

Viewed 100

I am developing a C# bot for messenger channel using Microsoft Bot Framework, my issue is that the bot should send an image as an attachment, I save the json attachment in channel data as you see in the following code.

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; }
}

In emulator, you can see that channel data section has the values for this image. I check that the image exist in the url and meets the requirements for facebook api (<25MB)

emulator_test.png

Until this point everything works perfectly but when I test the messenger channel, the image doesn't show up in the chat.

messenger_channel_test.jpg

What should I do to fix this issue?.

0 Answers
Related