Skip to main content

Microsoft Teams Integration

Post a card to a Microsoft Teams channel whenever a run finishes. It works for hosted runs, Playwright reporter runs and JUnit/Allure report uploads. Agnox sends an Adaptive Card with the run name, status, environment, pass/fail counts, the first failure and a link to the Investigation Hub.


Capabilities​

FeatureDescription
Adaptive Card notificationsTitle from the run name (then the run group, then the test folder), with facts for status, environment (including qa), results (passed · failed · skipped, plus quarantined), source (Agnox Hosted / External CI), run, group and duration
First failureThe first non-quarantined failure (test name and first lines of the error), with ANSI colour codes removed and secrets redacted
Every run sourceHosted runs, @agnox/playwright-reporter runs and POST /api/v1/reports (JUnit / Allure) uploads. Local runs from a developer machine never notify
Configurable triggersChoose which statuses send a card (PASSED, FAILED, ERROR, UNSTABLE)
Direct deep linkAn Open URL action to the run in the Agnox execution drawer
Send Test MessagePosts a sample card to the stored URL so you can check the channel

Step 1 — Create a Workflows webhook in Teams​

Microsoft is replacing Office 365 Connectors (the old Incoming Webhook connector) with Workflows.

  1. In Microsoft Teams, open the channel that should receive notifications.
  2. Click ··· (More options) next to the channel name → Workflows.
  3. Choose the template Post to a channel when a webhook request is received.
  4. Name it (e.g. Agnox), confirm the team and channel, and click Add workflow.
  5. Copy the webhook URL Teams shows.

:::info Webhook URL format Workflows URLs look like one of:

https://prod-00.westus.logic.azure.com:443/workflows/<id>/triggers/manual/paths/invoke?api-version=...&sig=...
https://<env>.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/<id>/triggers/manual/paths/invoke?...

Keep this URL confidential — anyone with it can post to your channel. Agnox stores it encrypted (AES-256-GCM) and never returns it. :::

Legacy connector URLs (https://<tenant>.webhook.office.com/webhookb2/...) are still accepted. Agnox sends those a MessageCard with the same facts. Move to Workflows before Microsoft retires connectors for your tenant.


Step 2 — Configure in Agnox​

  1. Go to Settings → Connectors.
  2. In the Microsoft Teams card, paste the webhook URL.
  3. Under Notify on Events, select the statuses that should post a card.
  4. Click Save Webhook. The card shows a Connected badge.
  5. Click Send Test Message to post a sample card to the channel.

Only organization admins can change or test the webhook.

:::note Accepted URLs To prevent server-side request forgery, Agnox only accepts HTTPS URLs on the default port, without credentials, on *.logic.azure.com/workflows/…, *.environment.api.powerplatform.com/…/workflows/… or *.webhook.office.com/webhookb2/…. Any other URL is rejected with 400 Invalid msTeamsWebhookUrl. :::


Card contents​

A FAILED card for a reporter run looks like this:

┌──────────────────────────────────────────────┐
│ FAILED — Nightly Checkout │
│ │
│ Status FAILED │
│ Environment qa │
│ Results 45 passed · 3 failed · 1 skipped │
│ Source External CI │
│ Run Nightly Checkout │
│ Group web-shop │
│ Duration 252s │
│ │
│ First failure │
│ Checkout > pays with card │
│ Error: expect(received).toBe(expected) │
│ │
│ [ View in Investigation Hub ] │
└──────────────────────────────────────────────┘

The payload is a Teams message with one attachment of type application/vnd.microsoft.card.adaptive (Adaptive Card 1.4), the format the Workflows webhook request trigger expects.

:::tip Reduce noise Select only FAILED and ERROR to keep the channel focused on runs that need attention. :::


Delivery​

  • Each delivery has a 10-second timeout and is tried up to 3 times (2 retries with backoff) on network errors, 429 and 5xx responses.
  • A failed delivery is logged and never affects the run.

Troubleshooting​

ErrorLikely Cause
400 Invalid msTeamsWebhookUrl when savingThe URL is not a Workflows or legacy connector URL (see Accepted URLs)
Send Test Message reports HTTP 400 / HTTP 404The workflow was deleted or turned off, or the URL was copied incompletely — create it again
No card for some runsNotify on Events doesn't include that status, or the run is a local run