teserak-airflow-providers-teams
Provider package for Microsoft Teams integration with Apache Airflow.
Installation
pip install teserak-airflow-providers-teams
Requirements
- Apache Airflow >= 2.11.0
- Python >= 3.10
Connection Setup
Configure an Airflow connection of type teams:
| Field | Description |
|---|---|
| Connection Id | e.g. teams_default |
| Connection Type | teams |
| Host | (leave empty) |
| Extra | {"webhook_url": "https://...webhook.office.com/..."} |
You can also pass the webhook_url directly to the hook/operator without a connection.
Teams uses Incoming Webhooks — create one via:
- Microsoft Teams: Apps → Incoming Webhooks → configure for a channel
- Power Automate Workflows (recommended, replaces older Office 365 connectors)
Usage
Hook
from teserak.airflow.providers.teams.hooks.teams_webhook import TeamsWebhookHook
from teserak.airflow.providers.teams.notifications.adaptive_card import (
AdaptiveCard,
TextBlock,
build_success_card,
)
hook = TeamsWebhookHook(
teams_conn_id="teams_default",
message="DAG finished successfully!",
)
hook.execute()
# With Adaptive Card
card = build_success_card(
dag_id="my_dag",
task_id="my_task",
execution_date="2024-01-15T10:30:00Z",
log_url="https://airflow.example.com/log",
)
hook = TeamsWebhookHook(teams_conn_id="teams_default", card=card)
hook.execute()
Operator
from teserak.airflow.providers.teams.operators.teams_webhook import TeamsWebhookOperator
notify = TeamsWebhookOperator(
task_id="send_teams_message",
teams_conn_id="teams_default",
message="Pipeline {{ dag.dag_id }} finished at {{ ts }}",
)
Notifier (on_failure_callback / on_success_callback)
from teserak.airflow.providers.teams.notifications.teams import TeamsNotifier
from teserak.airflow.providers.teams.notifications.adaptive_card import (
build_failure_card,
build_success_card,
)
with DAG(
dag_id="my_pipeline",
on_failure_callback=TeamsNotifier(
teams_conn_id="teams_default",
card=build_failure_card(
dag_id="my_pipeline",
log_url="https://airflow.example.com/log",
),
),
on_success_callback=TeamsNotifier(
teams_conn_id="teams_default",
card=build_success_card(
dag_id="my_pipeline",
log_url="https://airflow.example.com/log",
),
),
):
...
You can also use a plain text message instead of a card:
with DAG(
dag_id="my_pipeline",
on_failure_callback=TeamsNotifier(
teams_conn_id="teams_default",
text="DAG {{ dag.dag_id }} failed at {{ ts }}!",
),
):
...
Ready-made Success / Failure Cards
from teserak.airflow.providers.teams.notifications.adaptive_card import (
build_success_card,
build_failure_card,
)
# Success card — green header, checkmark, facts with DAG/task/time/log URL
success_card = build_success_card(
dag_id="my_dag",
task_id="my_task",
execution_date="2024-01-15T10:30:00Z",
log_url="https://airflow.example.com/log",
)
# Failure card — red header, cross, exception details
failure_card = build_failure_card(
dag_id="my_dag",
task_id="my_task",
execution_date="2024-01-15T10:30:00Z",
exception="ValueError: unexpected value",
log_url="https://airflow.example.com/log",
)
Adaptive Card Structure
Teams uses Adaptive Cards instead of Discord's Embed objects.
All types are fully typed as TypedDict:
AdaptiveCard— root card (body, actions, $schema, version)TextBlock— text elements with size/weight/color/wrapFactSet/Fact— key-value pairs (analogous to Discord EmbedField)Image— image elementColumnSet/Column— multi-column layoutContainer— grouping container with optional backgroundActionOpenUrl/ActionSet— clickable button actions
Metadata
Release files for teserak-airflow-providers-teams 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| teserak_airflow_providers_teams-1.0.0.tar.gz | 241.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| teserak_airflow_providers_teams-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 255.8 kB
Release files / teserak_airflow_providers_teams-1.0.0.tar.gz
| Download URL | teserak_airflow_providers_teams-1.0.0.tar.gz |
|---|---|
| Size | 241.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb5510988551b0ba6bc19353630f384111d8fe67a187bda8260cc37e972201b7
|
|
BLAKE2b-256 checksum How to use checksums |
5340990f01b4b235aebb0b6b6628c0678c4609e517631f9b4f5e8be6947844f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.
Transparency logRelease files / teserak_airflow_providers_teams-1.0.0-py3-none-any.whl
| Download URL | teserak_airflow_providers_teams-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cce0f71d0ea087d2ac810b6b042f42bea913bba3973f15f211762a76851be4dd
|
|
BLAKE2b-256 checksum How to use checksums |
8096bd37223f3a915f496ba89a209529e3534eb63affbd56b34e167c55f72b02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.
Transparency log