---
title: "Microsoft Teams"
description: "Post TRUSTIVAN alerts to a Microsoft Teams channel as Adaptive Cards through a Workflows webhook or a legacy Office 365 connector URL."
---

TRUSTIVAN posts to Teams through an **incoming webhook URL**. It is not a Teams
app: there is no bot, no message extension, and nothing in Teams can change a
finding. Each message is an Adaptive Card with a title, the details and an
**Open in TRUSTIVAN** button.

Two kinds of URL are accepted, because Microsoft is retiring one in favour of
the other and a tenant may have either:

- a **Workflows** (Power Automate) webhook, served from `*.logic.azure.com` or
  `*.azure-apim.net`. This is the one to create today.
- a legacy **Office 365 connector** URL, served from `*.webhook.office.com`.

The same card body works on both, so nothing in TRUSTIVAN changes if you move
from one to the other: rotate the URL and carry on.

## Prerequisites

- **The webhook URL.** In Teams, open the channel's **Workflows**, choose the
  template that posts to a channel when a webhook request is received, finish
  the wizard and copy the URL it shows. It is the credential: anyone holding it
  can post to that channel.
- **An administrator of the TRUSTIVAN organization**, signed in with `curl` so
  `cookies.txt` holds the session (see the [quickstart](/getting-started/quickstart)).
  Changing notifications needs `webhooks:manage`, which an API key cannot hold.
- **A plan that includes webhooks.**

## Create the destination

```bash
curl -s -X POST https://app.trustivan.com/api/v1/notification-targets \
  -H 'Content-Type: application/json' \
  -b cookies.txt \
  -H "X-CSRF-Token: $(grep trustivan_csrf cookies.txt | awk '{print $7}')" \
  -d '{
        "name": "appsec-teams",
        "channel": "teams",
        "secret": "https://….logic.azure.com/workflows/…",
        "events": ["verdict.recorded", "scan.completed", "finding.sla_breached"],
        "min_severity": "high"
      }'
```

The URL goes in `secret`, not `url`, so it is stored encrypted, and it must be
`https://`. A Teams destination takes no `config`: the URL already names the
channel.

## Test it

```bash
curl -s -X POST "https://app.trustivan.com/api/v1/notification-targets/$TARGET_ID/test" \
  -b cookies.txt \
  -H "X-CSRF-Token: $(grep trustivan_csrf cookies.txt | awk '{print $7}')"

curl -s "https://app.trustivan.com/api/v1/notification-targets/$TARGET_ID" -b cookies.txt \
  | jq '.target | {enabled, last_success_at, last_error}'
```

The test is queued (`202`) and delivered by the same worker as a real message.
Treat the destination as unconfirmed until `last_success_at` is set.

## What it posts

| Event | When it posts |
|---|---|
| `scan.completed` | A scan found new critical or high findings |
| `verdict.recorded` | A verdict blocks a deployment |
| `finding.state_changed` | A finding is resolved, suppressed, reopened or has its status changed |
| `finding.sla_breached` | Findings newly pass their remediation deadline |
| NHI Security events | Posture finding changes, expiring credentials, denied agent actions |

`audit.recorded` is also accepted, and needs the audit export entitlement. A
Teams message cannot be edited later, so a finding that is resolved is a second
card, not an update to the first.

## Troubleshooting

| Symptom | Cause |
|---|---|
| `400` naming the URL field | The webhook URL was sent as `url`. Send it as `secret` |
| `400` about settings | A Teams destination has no `config`. Remove it |
| `last_error` after a test | The workflow was turned off or deleted, or its owner left. Create a new one and replace the URL with `POST /api/v1/notification-targets/{id}/rotate-secret` |
| The destination was disabled automatically | Deliveries failed repeatedly. Fix the cause, then `PATCH` it with `{"enabled": true}` |

## See also

- [Send notifications to Slack, Jira and other tools](/how-to/configure-notifications):
  every channel, field and limit
- [Slack](/integrations/slack)
- [Webhooks](/integrations/webhooks): the signed envelope, to write your own receiver
