Microsoft deprecating Teams Webhooks October 1st 2024
Strikeman
Posts: 1 Bronze 1
Hi all,
MS is deprecating Teams Webhooks, and as you might be relying on them here is how to move your custom Teams webhook to a Teams workflow. This guide assumes you are using the default Teams message template from the Redgate Monitor Documentation found here: https://documentation.red-gate.com/sm13/custom-webhook-messages-195789529.html :
1. Go to the MS Teams channel where you receive your Redgate Monitor alerts.
2. Click on the 3 dots and select "Workflows".
3. Scroll down and choose "Post to a channel when a webhook request is received".
4. Remove the default "foreach" (step2) and replace it with a new step "Post a card in a channel".
5. Put this block of code in your "Adaptive Card":
{<br> "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",<br> "type": "AdaptiveCard",<br> "version": "1.2",<br> "body": [<br> {<br> "type": "TextBlock",<br> "text": "@{triggerOutputs()['body']['sections'][0]['activityTitle']}",<br> "weight": "Bolder",<br> "size": "Medium"<br> },<br> {<br> "type": "TextBlock",<br> "text": "@{triggerOutputs()['body']['sections'][0]['activitySubtitle']}",<br> "wrap": true,<br> "isSubtle": true,<br> "spacing": "None"<br> },<br> {<br> "type": "FactSet",<br> "facts": [<br> {<br> "title": "Status",<br> "value": "@{triggerOutputs()['body']['sections'][0]['facts'][0]['value']}"<br> },<br> {<br> "title": "Level",<br> "value": "@{triggerOutputs()['body']['sections'][0]['facts'][1]['value']}"<br> },<br> ]<br> }<br> ],<br> "actions": [<br> {<br> "type": "Action.OpenUrl",<br> "title": "View Alert",<br> "url": "@{triggerOutputs()['body']['potentialAction'][0]['targets'][0]['uri']}"<br> }<br> ],<br> "summary": "@{triggerOutputs()['body']['summary']}"<br>}
6. Save this workflow; it will generate a URL for you.
7. Go into Redgate Monitor -> Alerts -> Notification Settings -> Webhook notification and change the URL to this new URL; press "Preview and test".
Old card with webhook:
new card with workflow: