从 Azure 数据工厂 v2 向 MS Teams 发送 Office 365 连接器卡
Sending Office 365 Connector Card to MS Teams from Azure Data Factory v2
我正在尝试使用 ADFv2 的网络挂钩功能向使用 Office 365 连接卡的 Teams 发送消息。
我在 Teams 中设置了一个 webhook,可以从 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": "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。消息卡应该适用于在 Teams 或 outlook 中创建的传入 webhook。”
我正在尝试使用 ADFv2 的网络挂钩功能向使用 Office 365 连接卡的 Teams 发送消息。
我在 Teams 中设置了一个 webhook,可以从 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": "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。消息卡应该适用于在 Teams 或 outlook 中创建的传入 webhook。”