Send Microsoft Teams Notifications with TestingBot Webhooks
With the Microsoft Teams webhook template, a card appears in your Teams channel whenever a test completes, or only when one fails. The card lists the browser, platform, duration and status of the test, with a View test button that opens the full test report on TestingBot.
Prerequisites
You need an incoming webhook URL for the Teams channel that should receive the notifications:
- In Microsoft Teams, open the channel, click the ... menu and choose Connectors (or Manage channel > Connectors).
- Find Incoming Webhook, click Configure, give it a name and optionally an icon.
- Click Create and copy the generated webhook URL.
If your organization has retired Office 365 connectors, you can create the incoming webhook with the Workflows app in Teams instead; the resulting URL works the same way.
Set up the webhook in TestingBot
- Log in to the member area and go to the Webhooks page.
- Click Create webhook.
- Under Start from a template, pick the Microsoft Teams tile. This prefills the HTTP method and the MessageCard payload.
- Paste your Teams webhook URL in the URL field.
- Adjust the triggers: failures only or all tests, the test type and an optional name filter.
- Click Create webhook at the bottom of the form to save the configuration.
Template payload
The Microsoft Teams template sends this MessageCard payload:
{
"@type": "MessageCard",
"@context": "https://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Test {{TEST_STATUS}}: {{TEST_NAME}}",
"title": "Test {{TEST_STATUS}}: {{TEST_NAME}}",
"sections": [
{
"facts": [
{ "name": "Browser", "value": "{{BROWSER_NAME}} {{BROWSER_VERSION}}" },
{ "name": "Platform", "value": "{{PLATFORM}}" },
{ "name": "Duration", "value": "{{TEST_DURATION}} seconds" },
{ "name": "Status", "value": "{{TEST_STATUS}}" }
]
}
],
"potentialAction": [
{
"@type": "OpenUri",
"name": "View test",
"targets": [
{ "os": "default", "uri": "{{TEST_URL}}" }
]
}
]
}
There are no placeholders to replace: the target channel is determined by the webhook URL.
You can change the themeColor or add extra facts; the {{...}} tokens are documented on the built-in variables page.
Test it
Click Test Webhook in the form to send a sample card right away.
On success, the card shows up in your Teams channel and the Response panel reports a 200 status, usually with the body 1.
Common failure causes:
- The webhook URL was removed or the connector was deleted from the channel.
- Your organization blocks incoming webhooks; ask a Teams administrator, or use the Workflows app.
- The payload was edited into invalid JSON or an invalid MessageCard; Teams then returns a 4xx status with an error summary.
Related: Webhooks Quick Start, all webhook templates and the Slack walkthrough.