将 Office 365 连接器卡从 Azure 数据工厂 v2 发送到 MS 团队



我正在尝试使用 ADFv2 的 Web 挂钩功能使用 Office 365 连接器卡向团队发送消息。

我已经在团队中设置了一个网络钩子,并且可以成功从 ADF 发送简单的 JSON 有效负载

例如

{"text":"Hello World!"}

但是,如果我尝试文档 ADFv2 中的 Office 365 连接器消息示例,则无法将有效负载识别为有效的 JSON。

有人知道我如何以 ADFv2 接受的方式构建下面的 json 消息吗?

我试过了 - 动态构建字符串并包装@json函数 - 它抱怨传递的字符串不是有效的 JSON - 删除@符号 - 这会产生错误的请求错误

{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Larry Bryant created a new task",
"sections": [{
"activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)Larry Bryant created a new task",
"activitySubtitle": "On Project Tango",
"activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
"facts": [{
"name": "Assigned to",
"value": "Unassigned"
}, {
"name": "Due date",
"value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
}, {
"name": "Status",
"value": "Not started"
}],
"markdown": true
}],
"potentialAction": [{
"@type": "ActionCard",
"name": "Add a comment",
"inputs": [{
"@type": "TextInput",
"id": "comment",
"isMultiline": false,
"title": "Add a comment here for this task"
}],
"actions": [{
"@type": "HttpPOST",
"name": "Add comment",
"target": "http://..."
}]
}, {
"@type": "ActionCard",
"name": "Set due date",
"inputs": [{
"@type": "DateInput",
"id": "dueDate",
"title": "Enter a due date for this task"
}],
"actions": [{
"@type": "HttpPOST",
"name": "Save",
"target": "http://..."
}]
}, {
"@type": "ActionCard",
"name": "Change status",
"inputs": [{
"@type": "MultichoiceInput",
"id": "list",
"title": "Select a status",
"isMultiSelect": "false",
"choices": [{
"display": "In Progress",
"value": "1"
}, {
"display": "Active",
"value": "2"
}, {
"display": "Closed",
"value": "3"
}]
}],
"actions": [{
"@type": "HttpPOST",
"name": "Save",
"target": "http://..."
}]
}]
}

正如Trinetra-MSFT回答的那样:-

"ADFv2不支持消息卡,它们支持简单的JSON。消息卡应该适用于在团队或 Outlook 中创建的传入网络钩子。

最新更新