Uploading images as part of attachment
Sending images to people that are already uploaded somewhere works perfectly! In one of the scenarios in my bot, I have it create a GIF on-the-fly and then upload it directly (because I don't want to upload it to a hosting service first since it's a one-off). I know how to get this working with Facebook (see curl signature below) but how can I do this in BotBuilder?
curl
-F recipient='{"id":"USER_ID"}'
-F message='{"attachment":{"type":"image", "payload":{}}}'
-F filedata=@/tmp/shirt.png
"https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"
You can send the image in-line:
// send image inline WebClient webClient = new WebClient(); byte[] data = {your image as a byte array} var image64 = "data:image/jpeg;base64," + Convert.ToBase64String(data); reply.Attachments.Add(new Attachment() { ContentUrl = image64, ContentType = "image/jpeg", });
That's awesome, I'll give it a try! Thanks!
any thoughts on how this can be done with Node.js?
I tried:
var fileRead = fs.readFileSync("/home/srichakradhar/Documents/bots/PurchaseHelper/docs/IT Purchase Request Workbook.xlsx");
var base64File = fileRead.toString('base64,');
var attachment = "data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64," + base64File
But Skype shows warning and doesn't send any message (reply)
