Alert webhooks - Microsoft Teams connection
In this article, we will show how you can send the Eyer webhook alerts to a Microsoft Teams channel.
NOTE! The regular “incoming webhooks” integration is deprecated, so you will have to use Workflows.
Start by creating a Workflow
In Teams, click on “Apps” and search for “Workflows”. Open “Workflows”
Search for “Send webhook alerts to a channel” and select the template and give the flow a name
In the next step, select a team and a channel to where you want to send the alerts.
Click “Create flow”.
Copy the URL that is shown on the next page, and store it. This can be used to create a webhook subscription (read more here). Click “Done”
Next, click the “Home” in the “Workflows” window, you should now see your created flow. Click it and then select “Edit”
Delete the sections named “Initialize variable” AND “Attachments is null”.
Next, complete the steps below
Step 1: Extract Node Names (Select Action)
Click + New step
Search for "Select"
Name it:
ExtractNodeNamesConfigure:
From:
@variables('Body')?['changes']Map: Click "Switch to text mode" (T<sub>x</sub> icon) and enter:
@{item()?['nodeName']}Step 2: Create Unique Node List (Compose Action)
Click + New step
Search for "Compose"
Name it:
UniqueNodesJoinedInputs:
@{replace(join(union(body('ExtractNodeNames'), body('ExtractNodeNames')), ', '), '"', '')}This creates a comma-separated list of unique node names.
Step 3: Post to Teams (Adaptive Card)
Click + New step
Search for "Post card in a chat or channel" (Microsoft Teams connector)
Configure:
Post as: Flow bot
Post in: Channel
Team: Select your team from dropdown
Channel: Select your channel from dropdown
Adaptive Card: Paste the following JSON:
Code for Adaptive Card
{
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "🚨 @{toUpper(variables('Body')?['impact']?['name'])} Impact Alert",
"weight": "Bolder",
"size": "Large"
},
{
"type": "TextBlock",
"text": "**Alert ID:** @{variables('Body')?['alertId']} \n**Learning Status:** @{variables('Body')?['learningStatus']}",
"wrap": true
},
{
"type": "TextBlock",
"text": "**Affected Nodes:** \n@{outputs('UniqueNodesJoined')}",
"wrap": true,
"separator": true
}
]
}
}