1

I would like to respond to a conversation by providing a barcode (.PNG) that has been base64 encoded. Is that possible? Or is the only method of delivery thru a Url.

jchang1
  • 348
  • 4
  • 11

1 Answers1

3

Try:

replyMessage.Attachments.Add(new Attachment()
{
     ContentUrl = $"data:image/jpeg;base64,{Convert.ToBase64String(bdata)}"
});

Or as JSON:

{
    "attachments": 
    [
        {
            "contentUrl": $"data:image/jpeg;base64,{Convert.ToBase64String(bdata)}"
        }
    ]
}

Where bdata is a byte array

Lars
  • 9,976
  • 4
  • 34
  • 40