我创建了一个机器人(nodejs
服务器)的团队--通过机器人框架。
我想通过我创建的自适应卡来发送。自适应卡设计器
我得到的错误。
{"code":"BadArgument","message":"ContentType of an attachment is not set"}
该请求主体:
{
"type": "message",
"from": {
"id": "xxxxxx"
},
"conversation": {
"id": "xxxxxx"
},
"recipient": {
"id": "xxxxx"
},
"replyToId": "xxxxx",
"text": "some text",
"attachments": [
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "some text"
},
{
"type": "Input.Date",
"separator": true
}
]
}
]
}
我将感谢帮助
当添加附件时,你会想要设置附件中的 contentType
和 content
附件对象的属性。
{
"type": "message",
"from": {
"id": "xxxxxx"
},
"conversation": {
"id": "xxxxxx"
},
"recipient": {
"id": "xxxxx"
},
"replyToId": "xxxxx",
"text": "some text",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "some text"
},
{
"type": "Input.Date",
"separator": true
}
]
}
}
]
}
根据上面的评论,这是一个主动式消息,但使用Bot Framework库是一个比直接调用僵尸端点更好的方法(我想知道,你说的 "REST "是指Bot Framework端点还是Graph Api,但无论哪种情况,Bot Framework对于主动式消息都更容易操作)。
具体请看 本样本 以了解如何在Node中做到这一点。