17 Oct 2024 03:08 PM - edited 17 Oct 2024 03:10 PM
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
17 Oct 2024 04:40 PM
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.