New to Kestra?
Use blueprints to kickstart your first workflows.
Send automatic Microsoft Teams alerts on failed or warning Kestra executions using a single system flow, the Flow trigger, and TeamsExecution.
id: failure-alert-teams
namespace: system
triggers:
- id: on_failure
type: io.kestra.plugin.core.trigger.Flow
dependsOn:
- states:
- FAILED
- WARNING
tasks:
- id: send_alert
type: io.kestra.plugin.microsoft365.teams.TeamsExecution
url: "{{ secret('TEAMS_WEBHOOK') }}"
executionId: "{{ trigger.executionId }}"
Catch every failed or degraded workflow before it becomes an incident. This system flow posts a Microsoft Teams alert the moment any Kestra execution finishes in a FAILED or WARNING state, so you manage failure notifications from one central place instead of wiring alerts into every individual flow. It is a drop-in monitoring pattern for teams that already run their day in Teams and want execution failures surfaced in the right channel within seconds.
on_failure trigger of type io.kestra.plugin.core.trigger.Flow listens to executions across your instance.dependsOn entry with states: [FAILED, WARNING] filters those executions, firing only when the status is one of those states.send_alert task of type io.kestra.plugin.microsoft365.teams.TeamsExecution posts a message to your Teams channel. It uses the incoming {{ trigger.executionId }} so the alert links straight back to the failed execution.FAILED and WARNING executions.Kestra system flows turn the platform's own execution events into automation. The Flow trigger reacts to execution state changes the instant they happen (no polling, no cron), and the dependsOn states list keeps noise down by alerting only on real failures and warnings. Because the logic is declarative YAML, it is versioned, reviewable, and reusable across every namespace, with built in retries and full execution lineage. A messaging tool like Microsoft Teams has no awareness of your orchestration layer on its own; Kestra is what observes the failures and pushes them into the channel.
TEAMS_WEBHOOK: the incoming webhook URL for the target Microsoft Teams channel.TEAMS_WEBHOOK secret in Kestra.system namespace.when expression (for example {{ trigger.namespace startsWith 'company' }}) to the dependsOn entry. See the Administrator Guide.TeamsExecution payload to include richer context.