im-open / post-status-to-teams-action

A GitHub Action for posting a workflow's status update to Microsoft Teams
MIT License
0 stars 0 forks source link

ThemeColor has stopped working #20

Open mike-schenk opened 5 months ago

mike-schenk commented 5 months ago

Teams has stopped supporting the themeColor property of MessageCard. See https://github.com/MicrosoftDocs/msteams-docs/issues/10062

A possible replacement could be to use the new support for AdaptiveCards and their built-in limited "styles" on Containers, Columns, or TableCells.

See some reference documentation at

The following HTTP request body can be POSTed to the webhook connector URL and demonstrates some possibile ways to indicate success or failure.

Note the following in the example below:

{
   "type":"message",
   "attachments":[
      {
         "contentType":"application/vnd.microsoft.card.adaptive",
         "contentUrl":null,
         "content":{
            "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
            "type":"AdaptiveCard",
            "version":"1.5",
            "body":[
              {
                "type": "Table",
                "bleed": true,
                "showGridLines" : false,
                "columns": [{"width":1}],
                "rows": [
                  {
                    "type": "TableRow", "cells": [
                      {
                        "type": "TableCell", "style":"good", "bleed":true,  "items": [
                          { "type": "TextBlock", "text": "SUCCESS" }
                        ]
                      }
                      ]
                  }
                ]
              },
              {
                "type": "ColumnSet",
                "bleed": true,
                "columns": [
                  {
                    "type": "Column",
                    "bleed": true,
                    "style": "good",
                    "items": [
                      {
                        "type": "TextBlock", "text": "SUCCESS"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "Container",
                "style": "good",
                "bleed": true,
                "items": [{"type":"TextBlock", "text":"SUCCESS"}]
              },
              {
                "type": "Container",
                "style": "attention",
                "bleed": true,
                "items": [{"type":"TextBlock", "text":"FAILURE"}]
              },
              {
                "type": "Container",
                "style": "warning",
                "bleed": true,
                "items": [{"type":"TextBlock", "text":"CAUTION"}]
              },
                {
                "type": "TextBlock",
                "text": "For Samples and Templates, see [https://adaptivecards.io/samples](https://adaptivecards.io/samples)"
                }
            ],
            "msteams": { "width":"Full" }
         }
      }
   ]
}
martens-d commented 5 months ago

Hate to disappoint you, but you can't use AdaptiveCard, because it is not supported by connectors:

issue#742 #808

It's like always fixing the docs, but not the actual problem.