Since Flex is not supporting media messages im forced to do a workaround to store the file content in s3 bucket and update the media message with the link to s3.
Im using below code to update media message
http://localhost:8051/channel/CHe1XXXXXXXXXXXXXXXXX/messages/IMdb99326ebf7dXXXXXXXXXXXX
exports.updateMessage = async function (channelSID, messageSID, body) {
const messageObj = body;
const message = twilioClient.chat.services(variables.twilioServiceSID)
.channels(channelSID)
.messages(messageSID)
.update({
messageObj
})
.then(message => {
return message;
})
return message;
};
Request body:
{
"attributes":
{ "s3_url": "https://testingbucket.s3.us-east-2.amazonaws.com/fileupload" }
}
Response:
{"name":"test-adapter","hostname":"Abinaya","pid":14696,"level":30,"res":{"statusCode":200,"responseTime":1303,"headers":{"x-request-id":"4eb0077e-53e9-4965-9eb8-f0c314444d09","content-type":"application/json; charset=utf-8"}},"event":"response","body":{"status":"success","data":{"sid":"IMdb99326ebf7XXXXXXXXXXXXXX","attributes":"{}","to":"CHe16335c4a04643XXXXXXXXXXXXX","channelSid":"CHe16335c4a04XXXXXXXXXXXX","dateCreated":"2019-11-29T13:26:20.000Z","dateUpdated":"2019-12-02T09:31:58.000Z","lastUpdatedBy":"system","wasEdited":true,"from":"chintakindisantosh@gmail.com","body":null,"index":20,"type":"media","media":{"size":119238,"filename":"dominos.png","content_type":"image/png","sid":"MEb683c0cd51391f4bXXXXXXXXXX"}},"message":"Message updated successfully"},"msg":"request end","time":"2019-12-02T09:31:58.669Z","v":0}
Even after receiving 200 OK media message is not updated.