Twilio Client Chat - Send media message

久未见 提交于 2019-12-11 07:19:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!