【发布时间】:2017-11-08 11:58:11
【问题描述】:
我尝试使用session.send 通过会话发送 JSON 字符串化对象或附件,我在控制台中收到以下错误,但未收到机器人的任何响应。
错误:对“https://smba.trafficmanager.net/apis/v3/conversations/SOMEHASHCODE/activities”的请求失败:[400] 错误请求
当我在 Microsoft Bot Framework 中检查 Skype 频道问题时,我看到 JSON 对象的以下消息
消息文本中的 XML 无效
以及以下附件消息。
未知的附件类型
机器人在 Slack 和 Emulator 中运行良好。所以应该不是代码的问题。
// JSON object
session.send(JSON.stringify(session.conversationData.inputData, null, 2));
// Attachment message
session.send(new builder.Message(session)
.text(`Here's the document:`)
.addAttachment({
contentUrl: `http://host:port/${filePath}`,
contentType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
name: 'Document.docx',
}));
发送的 JSON 对象是{"name": "Philip John", "id": "444411111111", "phone": "54545454", "email": "philip@john.com", "address": "Street 11 - 111, City , ", "job": "Software Tester", "date": "1st June 2017", "salary": "9000", "bankAccount": "DE121231231231231231" }
知道如何解决这个问题吗?
【问题讨论】:
-
你能分享导致错误的JSON对象吗?
-
@NilsW 请检查。添加了 JSON 对象。
-
对于问题 #2 - Word 文件附件,您能否链接到产生错误的示例文件?
标签: bots botframework skype