本文介绍了Twilio客户端聊天-发送媒体消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Chat Client中发送媒体消息?我正在使用JS SDK,并基于教程 https://www .twilio.com/docs/api/chat/guides/media-support ,但出现错误.我正在这样使用sendMessage方法:

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' });

错误消息:

{
  commandId: "e289ff36-4d9d-4fdb-8e36-46078c7228ef"
  response {
    responseTime: "2017-10-02T00:20:26.675Z"
    status: 50107
    statusText:"User unauthorized for command"
  }
}

推荐答案

(Twilio Chat开发人员在这里)

(Twilio Chat dev is here)

为了能够发送彩信,用户应该对所使用的角色具有sendMediaMessage权限(也应该具有sendMessage权限,但这很可能已经存在).

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).

请参见 https://www.有关详细信息,请访问twilio.com/docs/api/chat/guides/media-support#required-role-permission .

这篇关于Twilio客户端聊天-发送媒体消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 12:37