How to use customized cards with Microsoft Teams webhook

我们两清 提交于 2020-04-18 07:06:52

问题


Adaptive cards receive "bad request 400" error

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.

Example of working card:

{'@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).'}

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', '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'}

What is wrong with my POST request?


回答1:


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.



来源:https://stackoverflow.com/questions/57223491/how-to-use-customized-cards-with-microsoft-teams-webhook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!