问题
How can I send media message in Chat Client ? I'm using JS SDK and base on the tutorial https://www.twilio.com/docs/api/chat/guides/media-support, but getting error. I'm using the sendMessage
method like this:
channel.sendMessage({ contentType: 'image/png', media: 'base64 string image' });
The error message:
{
commandId: "e289ff36-4d9d-4fdb-8e36-46078c7228ef"
response {
responseTime: "2017-10-02T00:20:26.675Z"
status: 50107
statusText:"User unauthorized for command"
}
}
回答1:
(Twilio Chat dev is here)
In order to be able to send multimedia messages, user should have a sendMediaMessage permission for the role used (and sendMessage one as well -- but this most likely is already there).
See https://www.twilio.com/docs/api/chat/guides/media-support#required-role-permission for the details.
来源:https://stackoverflow.com/questions/46518137/twilio-client-chat-send-media-message