团队中的自适应卡不起作用 - REST API
Adaptive card in teams not workig - REST API
我通过机器人框架为团队创建了一个机器人(nodejs
服务器)。
我正在尝试发送我创建的自适应卡:adaptive cards designer
我得到错误:
{"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
}
]
}
]
}
非常感谢帮助
根据上面的评论,这是一条主动消息,但使用 Bot Framework 库是比尝试直接调用机器人端点更好的方法(我想知道 "REST",您指的是 Bot Framework 端点或 Graph Api,但在任何一种情况下,Bot Framework 都更易于处理主动消息)。
请具体参阅 this sample 以了解如何在 Node 中执行此操作。
添加附件时,您需要设置附件对象的 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
}
]
}
}
]
}
我通过机器人框架为团队创建了一个机器人(nodejs
服务器)。
我正在尝试发送我创建的自适应卡:adaptive cards designer
我得到错误:
{"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
}
]
}
]
}
非常感谢帮助
根据上面的评论,这是一条主动消息,但使用 Bot Framework 库是比尝试直接调用机器人端点更好的方法(我想知道 "REST",您指的是 Bot Framework 端点或 Graph Api,但在任何一种情况下,Bot Framework 都更易于处理主动消息)。
请具体参阅 this sample 以了解如何在 Node 中执行此操作。
添加附件时,您需要设置附件对象的 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
}
]
}
}
]
}