我在使用bot框架REST API通过Skype频道发送附件时遇到问题.
I've problems sending attachments through a Skype channel using the bot framework REST API.
我能够使用这样的json消息正确发送图像:
I'm able to correctly send images using a json message like this:
{ "type":"message", "timestamp":"2017-05-22T11:31:36.2281894Z", "from":{ "name":"MyBot" }, "recipient":{ "id":"29:1-Dl1xMx6G2qGya5O5BgTZJhc0fUKOiQLctt74CmwJ3PVJNgkocpf3LY626py9UIO" }, "text":"It works!", "attachments": [ { "contentType": "image/jpg", "contentUrl": "g87a2173.ngrok.io/content/attachments/65f2be10-e61e-424e-9ea1-e05f1002fd19", "name": "image.jpg" } ] }但是,如果我发送的图像类型不是图像,则出现错误.
But if I send files with any content type other than image I have an error.
例如,如果我发送
{ "type":"message", "timestamp":"2017-05-22T11:31:36.2281894Z", "from":{ "name":"MyBot" }, "recipient":{ "id":"29:1-Dl1xMx6G2qGya5O5BgTZJhc0fUKOiQLctt74CmwJ3PVJNgkocpf3LY626py9UIO" }, "text":"Not working!", "attachments": [ { "contentType": "audio/wav", "contentUrl": "g87a2173.ngrok.io/content/attachments/e58bcefa-7060-464f-96ee-78d2795ec80f", "name": "audio.wav" } ] }我收到400错误
{ "error": { "code": "BadArgument", "message": "Unknown attachment type" } }用于这些测试的其余端点是
The rest endpoint used for these tests is smba.trafficmanager/apis/v3/conversations/29%3A1-Dl1xMx6G2qGya5O5BgTZJhc0fUKOiQLctt74CmwJ3PVJNgkocpf3LY626py9UIO/activities
API参考文档指出
附件可以是媒体文件(例如,音频,视频,图像,文件)或 一张丰富的卡
An attachment may be a media file (e.g., audio, video, image, file) or a rich card
那我在哪里错了?
谢谢
推荐答案我使用C#代码尝试了相同的操作,并得出了相同的结论:在Skype Channel上,我们为此出现了Unknown attachment type异常. 在模拟器和Slack上工作(获得了下载wav文件的链接)
I tried the same with C# code and got the same conclusion: on Skype Channel, we got an Unknown attachment type exception for this. Working on emulator and Slack (got a link to download the wav file)
必须有一个频道限制,或者是一个错误.
There must be a channel limitation yes, or a bug.
无论如何,您都可以尝试使用AudioCard:我已经在C#代码中对其进行了测试,并且可以在Skype上运行:
Anyway you may try to use AudioCard: I tested it (in C# code) and it's working on Skype:
此处的示例代码: github/Microsoft/BotBuilder-Samples/tree/master/CSharp/cards-RichCards
更多推荐
REST API附件错误
发布评论