如何通过 Microsoft Teams webhook 使用自定义卡片

How to use customized cards with Microsoft Teams webhook

自适应卡收到 "bad request 400" 错误

我正在尝试使用 urlopen 方法从 AWS Lambda 运行 Python 3.7 发送 POST 请求

我有一个正常的卡请求,但自适应卡会遇到上述错误。

工作卡示例:

{'@context': 'https://schema.org/extensions', '@type': 'MessageCard', 'themeColor': 'd63333', 'title': 'Red Alert - There is an issue Example alarm name', 'text': '示例警报名称 已从正常更改为警报 - 已超过阈值:1 个数据点 (10.0) 大于或等于阈值 (1.0) .'}

自定义卡片示例(获取错误请求错误 - 400):

{'@context': 'https://schema.org/extensions', '@type': 'AdaptiveCard', 'padding': 'none', 'body': [{ 'type': 'Container', 'style': 'emphasis', 'items': [{'type': 'ColumnSet', 'columns': [{'type': 'Column', 'items': [{'type': 'Image', 'horizontalAlignment': 'Right', 'url': 'https://miro.medium.com/max/1000/1*sszpZOih_xJV_lZsDbog-Q.png', 'height': '50px' , 'altText': 'MC Logo'}], 'width': 'auto'}]}]}, {'type': 'Container', 'padding' : {'top': 'none', 'left': 'default', 'bottom': 'default', 'right': 'default'} , 'items': [{'type': 'Container', 'items': [{'type': 'ColumnSet', 'spacing': 'Large', 'separator': 1, 'columns': [{'type': 'Column', 'verticalContentAlignment': 'center', 'items': [ {'type': 'Image', 'horizontalAlignment': 'Center', 'style': 'Person', 'url': 'https ://www.sccpre.cat/mypng/detail/57-574129_4-warning-stamp-vector-png-transparent-svg-warning.png', 'width': '60px', 'altText': 'warning logo'}], 'width': '60px'}, {'type': 'Column', 'items': [{'type': 'TextBlock', 'size': 'Medium', 'text': '示例警报名称 问题描述', 'wrap': 1}, {'type': 'TextBlock', 'spacing': 'None', 'text': 'MC ETL Process notifier', 'isSubtle': 1}], 'width': 'stretch'}]}, {'type': 'FactSet', 'facts': [{'title': 'Incident time:', 'value': '06/07/2019 03:10:12 AM CT '}, {'title': 'Component:', 'value': 'AWS Glue - insert funds job'}, {'title': 'Overall nightly done:', 'value': '73%'}]}, { 'type': 'TextBlock', 'spacing': 'Small', 'weight': 'Bolder', 'color': 'Accent', 'size': 'Medium', 'text': '点击重启'}, {'type': 'TextBlock', 'spacing': 'Small', 'weight': 'Bolder', 'color': 'Accent', 'size': 'Medium', 'text': '点击查看日志'}]}]}], 'version': '1.0'}

我的 POST 请求有什么问题?

目前,Teams 传入的 Webhook 不支持自适应卡片。您只能在连接器消息中发送 Message Card。我们正在致力于自适应卡支持,但没有时间表可以分享。