[英]Adaptive card in teams not workig - REST API
我通過機器人框架為團隊創建了一個機器人( 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
}
]
}
]
}
我會很感激幫助
添加附件時,您需要設置附件 object 的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 庫比嘗試直接調用 bot 端點更好(我想知道“REST”是指 Bot Framework 端點還是Graph Api,但無論哪種情況,Bot Framework 都更容易用於主動消息)。
請具體查看此示例以了解如何在 Node.js 中執行此操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.