Microsoft Teams for Alert Notifications
Last updated
Last updated
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.
For Microsoft Teams:
You must have permissions to Create a channel, Manage lists, Edit items, and Post messages in a channel.
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.
b. Fill in the fields for the new channel.
Open your chosen channel and click the ellipsis on the top right to open the menu and click Workflows.
In the search window, type “webhook” to filter options, and click “Post to a channel when a webhook request is received” under Templates.
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.
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.
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.
Click Add workflow to complete.
Once created, you will see a confirmation dialog that includes the URL to send the webhooks to.
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 create https://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.
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”.
In this screen, you will see all the workflows created. Open the relevant workflow.
Click Edit in the top left.
On the edit screen, click "When a Teams webhook request is received".
This reveals the HTTP POST URL.
In Teams, open Workflows by clicking the ellipsis from the lefthand menu in MS Teams.
Select the workflow you just created.
Click Edit.
Select “Send each adaptive card” then click “Post card in a chat or channel”
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.
Click Save.
In the ThousandEyes platform, navigate to Integrations and click + New Integration in the top right.
In the side panel that opens, select Custom Webhook.
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.
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.
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 page within the relevant account group, automatically filtered by the alert ID.
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 page within the relevant account group, automatically filtered by the alert ID.
For more information on configuring webhooks, see Custom Webhooks.