Skip to main content

Microsoft Teams Destination

Post messages to a Microsoft Teams channel via an Incoming Webhook. Supports plain text / MessageCard and Adaptive Card JSON payloads.

YAML Exampleโ€‹

destination:
type: teams
webhook_url_env: TEAMS_WEBHOOK_URL
message_template: "๐Ÿ”” New signup: **{{ row.name }}** ({{ row.email }})"

Configurationโ€‹

FieldTypeDefaultDescription
type"teams"โ€”Required
webhook_urlstring | nullnullWebhook URL (direct value)
webhook_url_envstring | nullnullEnv var containing the webhook URL
message_templatestring"{{ row }}"Jinja2 template for the message body
adaptive_cardboolfalseIf true, treat message_template as an Adaptive Card JSON payload
retryobject | nullnullPer-destination retry override (see sync.retry)

Authenticationโ€‹

Create an Incoming Webhook connector on the target Teams channel (channel โ†’ โ‹ฏ โ†’ Connectors โ†’ Incoming Webhook), then store the URL in an env var:

export TEAMS_WEBHOOK_URL="https://outlook.office.com/webhook/..."

Prefer webhook_url_env over the inline webhook_url โ€” drt validate flags hardcoded secrets (v0.7.5+).

Common Patternsโ€‹

Plain text alert:

message_template: "๐Ÿšจ **Alert:** {{ row.message }} (severity: {{ row.level }})"

Adaptive Card (richer layout โ€” the template is the full Adaptive Card JSON; drt wraps it in the attachments envelope):

adaptive_card: true
message_template: |
{
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{ "type": "TextBlock", "size": "Medium", "weight": "Bolder",
"text": "{{ row.name }} just signed up" },
{ "type": "TextBlock", "text": "Email: {{ row.email }}", "wrap": true }
]
}

Rate limitingโ€‹

Vendor limit: Microsoft throttles incoming webhooks per connector (commonly documented as ~4 requests/second per connector, with longer-window caps). drt applies no automatic cap here โ€” set one explicitly:

destination:
type: teams
webhook_url_env: TEAMS_WEBHOOK_URL
rate_limit:
requests_per_second: 4
burst: 4 # optional: allow a short catch-up burst after idle time

destination.rate_limit beats sync.rate_limit, which beats the default of 10/s.

The limiter is shared per webhook URL โ€” and since a Teams webhook is channel-scoped, that means per channel. Several syncs posting to one channel concurrently (drt run --threads 4) pace through one bucket instead of one bucket each. When two syncs share a webhook but request different rates, the lowest wins for both.

Notesโ€‹

  • (core) โ€” no extra install required.
  • One POST per row. For real-time alerts use batch_size: 1; for bursty syncs set rate_limit.requests_per_second to stay under the channel's webhook throttling.
  • Webhook delivery failures surface as row errors; on_error: skip (default for webhook-style destinations) keeps the rest of the batch going.
  • The webhook URL is channel-scoped โ€” one URL per channel. Use a sync-specific webhook to route different syncs to different channels.

Referencesโ€‹