Background
We recently updated our /upload endpoint to support metadata (e.g. thumbnailUrl) for attachments. The service work is carried out by @NickEricson and did not introduce backward compatibility issues.
This work is required for microsoft/BotFramework-WebChat#2422.
Changes
Instead of removing activity.attachments, we leave the attachments array but only removing activity.attachments[].contentUrl. This will send contentType and thumbnailUrl to the service.
The service will match metadata by looking at:
activity.attachments[].name
filename of multipart, where the multipart has name equals to file
Quicklook
Today
-------boundary
Content-Disposition: form-data; name="activity"; filename="blob"
Content-Type: application/vnd.microsoft.activity
{
"from": {
"id": "dl_1234567"
},
"type": "message",
...
}
-------boundary
Content-Disposition: form-data; name="file"; filename="abc.png"
Content-Type: image/png
...
-------boundary
Tomorrow
-------boundary
Content-Disposition: form-data; name="activity"; filename="blob"
Content-Type: application/vnd.microsoft.activity
{
+ "attachments": [{
+ "contentType": "image/png",
+ "name": "abc.png",
+ "thumbnailUrl": "data:image/jpeg;base64,..."
+ }],
"from": {
"id": "dl_1234567"
},
"type": "message",
...
}
-------boundary
Content-Disposition: form-data; name="file"; filename="abc.png"
Content-Type: image/png
...
-------boundary
Note: the filename field on multipart is used for matching the corresponding item in the attachments array.
Background
We recently updated our
/uploadendpoint to support metadata (e.g.thumbnailUrl) for attachments. The service work is carried out by @NickEricson and did not introduce backward compatibility issues.This work is required for microsoft/BotFramework-WebChat#2422.
Changes
Instead of removing
activity.attachments, we leave theattachmentsarray but only removingactivity.attachments[].contentUrl. This will sendcontentTypeandthumbnailUrlto the service.The service will match metadata by looking at:
activity.attachments[].namefilenameof multipart, where the multipart hasnameequals tofileQuicklook
Today
Tomorrow
-------boundary Content-Disposition: form-data; name="activity"; filename="blob" Content-Type: application/vnd.microsoft.activity { + "attachments": [{ + "contentType": "image/png", + "name": "abc.png", + "thumbnailUrl": "data:image/jpeg;base64,..." + }], "from": { "id": "dl_1234567" }, "type": "message", ... } -------boundary Content-Disposition: form-data; name="file"; filename="abc.png" Content-Type: image/png ... -------boundary