Microsoft Teams for Alert Notifications
This article shows you how to receive ThousandEyes alert notifications in a Microsoft Teams channel using custom webhooks.
MS Teams uses MS Workflows to connect with third parties, such as ThousandEyes.
To receive alert notifications in a Microsoft Teams channel, set up a new workflow within Microsoft Teams and a custom webhook within ThousandEyes.
Prerequisites
For Microsoft Teams:
You must have permissions to Create a channel, Manage lists, Edit items, and Post messages in a channel.
Steps Within Microsoft Teams
Log in to Microsoft Teams.
Configure a Teams channel for the custom webhook to use for alerts from ThousandEyes. You can create a new Teams channel or use an existing one.
a. To create a new channel, click Add Channel within the dropdown menu accessible via the ellipsis next to your Team.
Add channel button b. Fill in the fields for the new channel.
Create a channel dialog Open your chosen channel and click the ellipsis on the top right to open the menu and click Workflows.
Workflows button in channel menu In the search window, type “webhook” to filter options, and click “Post to a channel when a webhook request is received” under Templates.
Workflows templates screen In the resulting dialog, select what “Connection” the workflow should use. By default, the connection displays the MS Teams user’s email address. You can also elect to use a service account. We recommend using service accounts to ensure continuation of alerts since users can come and go.
a. To add a service account, click the ellipsis next to the user’s email and click + Add new connection.
Workflow connection options b. Select Use another account and enter the relevant credentials.
c. If you do not want to use a service account, and the user is the correct user, click Next.
Completed connection screen On the next screen, select the “Team” and “Channel” where the notifications should be posted to.
Note: If you select a private channel as the target, you need to customize the workflow as an additional step after creating the initial workflow. See Customizing Workflows for Private Channels.
Workflow team and channel options Click Add workflow to complete.
Once created, you will see a confirmation dialog that includes the URL to send the webhooks to.
Workflow completion screen with webhook URL This URL is not yet compatible with ThousandEyes. It includes percent-encoded characters that are not supported by ThousandEyes. To fix the URL and make it compatible:
Copy and paste the URL into any text editor (you cannot edit the URL within the dialog).
Replace the percent-encoded characters with their equivalent characters. For example, for
https://prod-81.westus.logic.azure.com:443/workflows/122c49e2573a46fc9c211efeb3dd/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=abcdefghijklmnopq
, replace the%2F
with a forward slash/
to createhttps://prod-81.westus.logic.azure.com:443/workflows/122c49e2573a46fc9c211efeb3dd/triggers/manual/paths/invoke?api-version=2016-06-01&sp=/triggers/manual/run&sv=1.0&sig=abcdefghijklmnopq
.If these characters are not changed, you will see an HTTP 401 error on ThousandEyes when you attempt to create the custom webhook.
Keep the edited URL somewhere you can later reference for the Steps Within ThousandEyes.
Click Done.
Retrieving the Workflow URL
If you closed the confirmation dialog and lost the link before you could copy it, navigate to the Workflows screen by clicking the ellipsis on the lefthand menu of MS Teams and select “Workflows”.
Workflows app in apps menu In this screen, you will see all the workflows created. Open the relevant workflow.
List of recently completed workflows Workflow details screen Click Edit in the top left.
On the edit screen, click "When a Teams webhook request is received".
This reveals the HTTP POST URL.
HTTP POST URL on edit screen
Customizing Workflows for Private Channels
In Teams, open Workflows by clicking the ellipsis from the lefthand menu in MS Teams.
Workflows app in apps menu Select the workflow you just created.
List of recently completed workflows Click Edit.
Workflow Edit button Select “Send each adaptive card” then click “Post card in a chat or channel”
Workflow Edit screen Modify the following fields:
In Post as, select “User”. The user owning the workflow must have access to the channel.
Leave Post in as “Channel”.
Select the Team and Channel.
Do not modify the Adaptive Card field.
Edit screen fields Click Save.
Steps Within ThousandEyes
In the ThousandEyes platform, navigate to Manage > Integrations and click + New Integration in the top right.
New Integration button on Integrations screen In the side panel that opens, select Custom Webhook.
Custom Webhook button Fill in the resulting fields as follows:
Name: The name should help you to quickly identify this integration.
URL: Saved in step 9 of Steps Within Microsoft Teams.
Do not override with the existing Microsoft Teams Preset Configuration. This configuration is no longer supported by Microsoft.
Headers: Add a Key-Value Pair with “content-type” as the key and “application/json” as the value.
Microsoft Teams supports Adaptive Cards v1.4. Paste the payload shown below into the Body field to create a simple card.
Note: Remember to edit the account group name you want to show up on the card in the body text.
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": **null**,
"content": {
"type": "AdaptiveCard",
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"spacing": "Small",
"horizontalAlignment": "Left",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"url": "https://app.thousandeyes.com/static/images/logo_128x128.png",
"width": "48px",
"height": "48px"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "ThousandEyes Alert Notification",
"wrap": true,
"horizontalAlignment": "Left",
"size": "Large",
"weight": "Bolder",
"separator": true
}
],
"horizontalAlignment": "Left",
"verticalContentAlignment": "Center"
}
],
"verticalContentAlignment": "Center"
}
]
}
],
"showBorder": false,
"horizontalAlignment": "Center",
"spacing": "None"
},
{
"type": "TextBlock",
"text": "Alert{{#eq type.id 2}} Triggered{{else}} Cleared{{/eq}}{{#if alert.test}} for {{alert.test.name}}{{/if}}",
"wrap": true,
"size": "Large",
"color": "{{#eq type.id 2}}Attention{{else}}Good{{/eq}}"
},
{
"type": "FactSet",
"facts": [
{
"title": "Account Group",
"value": "Edit here the Account Group name"
},
{
"title": "Rule Name",
"value": "{{alert.rule.name}} - {{formatExpression alert.rule.expression}}"
},
{
"title": "Severity",
"value": "{{alert.severity.display}}"
}
],
"separator": true
},
{
"type": "FactSet",
"facts": [
{
"title": "Alert ID",
"value": "{{alert.id}}"
}
],
"separator": true
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "Open this Alert",
"url": "{{#eq type.id 2}}https://app.thousandeyes.com/alerts/list/v2?__a={{alert.rule.account.id}}&tab=active&alertId={{alert.id}}{{else}}https://app.thousandeyes.com/alerts/list/v2?__a={{alert.rule.account.id}}&tab=history&alertId={{alert.id}}{{/eq}}",
"tooltip": "Click to open this Alert on ThousandEyes",
"iconUrl": "https://app.thousandeyes.com/static/images/logo_128x128.png"
}
],
"separator": true
}
]
}
}
]
}

Alternatively, use Microsoft’s card editor to customize your card, then paste that code in the Body field. Note that when using Microsoft’s card editor, the Adaptive Card object is nested inside the attachment’s content.

Click Test to verify that the new webhook is working.
A successful test returns a “Testing completed successfully!” message.
If the test fails:
Click Save to save the integration.
Re-open the integration and test it again.
If the test still fails, verify that the webhook URL in the ThousandEyes custom webhook matches the Microsoft Teams workflow URL from steps 9 and 10 in Steps Within Microsoft Teams and that you have added the key-value pair as a Header from step 3, above.
If the test still fails, contact ThousandEyes Support.
Click Save.
Apply the webhook to your existing alert rules using the resulting Manage Alert Rules side panel.
Manage Alert Rules screen
Receiving Alert Cards
If you used the code in the Body field from step 3 in Steps Within ThousandEyes, the resulting webhook will render an Adaptive Card in your chosen MS Teams channel that looks like the following:
When an alert is triggered:
The title text is red, and a link (via the Open this Alert button) takes you to the Active Alerts screen within the relevant account group, automatically filtered by the alert ID.
Alert triggered adaptive card Active Alerts screen showing triggered alert When an alert is cleared:
The title text is green, and a link (via the Open this Alert button) takes you to the Alerts History screen within the relevant account group, automatically filtered by the alert ID.
Alert cleared adaptive card Alerts History screen showing cleared alert
For more information on configuring webhooks, see Custom Webhooks.
Last updated