dagster-msteams

raw JSON →
0.29.3 verified Fri May 01 auth: no python

A Dagster resource for posting messages to Microsoft Teams via webhooks. Version 0.29.3, released as part of Dagster core 1.13.3. Supports Python 3.10-3.14. Follows Dagster library release cadence (roughly monthly).

pip install dagster-msteams
error Could not resolve resource 'teams' to a valid resource
cause Resource is not properly registered in Definitions or resource key mismatch.
fix
Ensure Definitions includes resources={"teams": TeamsResource(webhook_url=...)} and ops reference ResourceParam(TeamsResource) with required_resource_keys={"teams"}.
error ModuleNotFoundError: No module named 'dagster_msteams'
cause `dagster-msteams` not installed in the current environment.
fix
Run pip install dagster-msteams.
error ImportError: cannot import name 'TeamsResource' from 'dagster_msteams'
cause Using an old import path or ancient version.
fix
Run pip install --upgrade dagster-msteams and use from dagster_msteams import TeamsResource.
breaking The `TeamsResource` no longer accepts `webhook_url` during initialization as a positional argument; it must be passed as a keyword or via config.
fix Use `TeamsResource(webhook_url=...)` explicitly.
deprecated `make_teams_on_run_failure_sensor` is deprecated in favor of using `TeamsResource` directly with the core Dagster `RunFailureSensorContext`.
fix Prefer creating a custom sensor using `TeamsResource` and `@run_failure_sensor`.
gotcha Webhook URL must be a valid Microsoft Teams incoming webhook. Using a malformed URL will silently fail (no error raised).
fix Validate webhook URL format: `https://outlook.office.com/webhook/...`.

Minimal setup: define a TeamsResource, optional failure sensor, and attach to job/sensor in Definitions.

import os
from dagster import Definitions, job, op
from dagster_msteams import TeamsResource, make_teams_on_run_failure_sensor

@op
def my_op():
    return 1

@job
def my_job():
    my_op()

# Resource requires WEBHOOK_URL env var or config
teams_resource = TeamsResource(
    webhook_url=os.environ.get('TEAMS_WEBHOOK_URL', ''),
    webhook_resource_key="teams"
)

# Optional: notify on run failure
teams_sensor = make_teams_on_run_failure_sensor(
    webhook_url=os.environ.get('TEAMS_WEBHOOK_URL', ''),
    dagit_base_url="http://localhost:3000"
)

defs = Definitions(
    jobs=[my_job],
    resources={"teams": teams_resource},
    sensors=[teams_sensor]
)