cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MS teams Adaptive card for Problem notifications

nickmarchini
Newcomer

MS Teams have moved to Adaptive Cards when sending content via a webhook, it took me some time to wrap my head around this but here is my simple card. Hopefully you can extend it as needed. For some reason it would only work in version 1.4 but that might be uniqure you our MS Teams. 

 

 

{
  "type": "message",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.adaptive",
      "contentUrl": null,
      "content": {
        "type": "AdaptiveCard",
        "body": [
          {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "{ProblemSeverity} - {ProblemImpact}",
            "style": "heading",
            "wrap": true
          },
          {
            "type": "TextBlock",
            "text": "{ProblemTitle}",
            "wrap": true
          },
          {
            "type": "FactSet",
            "facts": [
              {
                "title": "PID:",
                "value": "{PID}"
              },
              {
                "title": "Problem Details:",
                "value": "{ProblemDetailsText}"
              }
            ]
          }
        ],
        "actions": [
          {
            "type": "Action.OpenUrl",
            "title": "View",
            "url": "{ProblemURL}",
            "role": "button"
          }
        ],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.4"
      }
    }
  ]
}

 

 

This is what the test message looks like

Screenshot 2024-10-17 at 15.00.34.png

2 REPLIES 2

linux43110
Observer

Thanks @nick !    Were you using the "Post to a channel when a webhook request is received" workflow template without modifications?   I'm getting the following error: 

Action 'Post_card_in_a_chat_or_channel' failed: Post as Power Apps can only be used to send Cards for Power Apps into Teams. Please add Cards for Power Apps action in your flow.


I've been actively working on getting Problem notifications working via the new MS Teams / PowerAutomate webhooks for the past few days and getting hung up on the proper formatting of the payload so your post above was quite timely and appreciated.


Hi @linux43110 

You can test using the Power apps and teams instead of Power Automate.

BR,

Peter

Featured Posts