Skip to main content

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:

  1. In Microsoft Teams, open the channel, click the ... menu and choose Connectors (or Manage channel > Connectors).
  2. Find Incoming Webhook, click Configure, give it a name and optionally an icon.
  3. 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

  1. Log in to the member area and go to the Webhooks page.
  2. Click Create webhook.
  3. Under Start from a template, pick the Microsoft Teams tile. This prefills the HTTP method and the MessageCard payload.
  4. Paste your Teams webhook URL in the URL field.
  5. Adjust the triggers: failures only or all tests, the test type and an optional name filter.
  6. 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.

Was this page helpful?
Last updated