如何在Microsoft Teams Webhook中使用自定义卡 [英] How to use customized cards with Microsoft Teams webhook

查看:386
本文介绍了如何在Microsoft Teams Webhook中使用自定义卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自适应卡收到错误请求400"错误

Adaptive cards receive "bad request 400" error

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

I'm trying to send a POST request from AWS Lambda running Python 3.7 using the urlopen method

我有一个正常的卡片请求正在运行,但是自适应卡片会遇到上述错误.

I have a regular card request that is working but an adaptive card will hit the error mentioned above.

工作卡示例:

{'@ context':' https://schema.org/extensions ','@type ':'MessageCard','themeColor':'d63333','title':'红色警报-存在问题示例警报名称','文本':'示例警报名称已从确定"更改为到警报-越过阈值:1个数据点(10.0)大于或等于阈值(1.0).'}

{'@context': 'https://schema.org/extensions', '@type': 'MessageCard', 'themeColor': 'd63333', 'title': 'Red Alert - There is an issue Example alarm name', 'text': 'Example alarm name has changed from OK to ALARM - Threshold Crossed: 1 datapoint (10.0) was greater than or equal to the threshold (1.0).'}

自定义卡的示例(出现错误的请求错误-400):

Example of customized card (getting bad request error - 400):

{'@ context':' https://schema.org/extensions ','@type ':'AdaptiveCard','padding':'none','body':[{'type':'Container','style':'emphasis','items':[{'type':'ColumnSet', 'columns':[{'type':'Column','items':[{'type':'Image','horizo​​ntalAlignment':'Right','url':'点击查看日志'}]}}}}],'version':'1.0'}

{'@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': 'Example alarm name issue description', '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': 'Click to restart'}, {'type': 'TextBlock', 'spacing': 'Small', 'weight': 'Bolder', 'color': 'Accent', 'size': 'Medium', 'text': 'Click to review logs'}]}]}], 'version': '1.0'}

我的POST请求出了什么问题?

What is wrong with my POST request?

推荐答案

当前,Teams传入的Webhooks不支持自适应卡.您只能发送消息卡在连接器消息中.我们正在为自适应卡提供支持,但没有时间表可共享.

Currently, Teams incoming Webhooks does not support Adaptive Cards. You can send only Message Card in connector messages. We are working on the Adaptive Card support but do not have timeline to share.

这篇关于如何在Microsoft Teams Webhook中使用自定义卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆