New to Kestra?
Use blueprints to kickstart your first workflows.
Trigger a Kestra flow when any labeled execution fails and send an email alert, using the ExecutionLabels condition on a Flow trigger to scope by owner.
id: flow-condition-executionlabels
namespace: company.team
triggers:
- id: flow_trigger
type: io.kestra.plugin.core.trigger.Flow
dependsOn:
- labels:
owner: john.doe
states:
- FAILED
tasks:
- id: send_email
type: io.kestra.plugin.email.MailExecution
to: john.doe@kestra.io
from: hello@kestra.io
subject: "The workflow execution {{ trigger.executionId }} failed for the flow
{{ trigger.flowId }} in the namespace {{ trigger.namespace }}"
host: mail.privateemail.com
port: 465
username: "{{ secret('EMAIL_USERNAME') }}"
password: "{{ secret('EMAIL_PASSWORD') }}"
executionId: "{{ trigger.executionId }}"
Get notified the moment a flow you care about fails, without polling or custom glue code. This blueprint listens across your Kestra instance for executions that carry a specific label and reach the FAILED state, then automatically sends a targeted email alert. It pairs the core io.kestra.plugin.core.trigger.Flow trigger with a dependsOn entry's labels field to scope alerting to exactly the workflows that matter, for example everything owned by a given team, so on-call engineers and flow owners hear about failures fast and stop chasing them in the UI.
io.kestra.plugin.core.trigger.Flow trigger watches all executions running on the instance.dependsOn entry filters that stream to executions tagged with labels: {owner: john.doe}.states listed, here FAILED.send_email task (io.kestra.plugin.email.MailExecution) sends an alert over SMTP, building the subject from {{ trigger.executionId }}, {{ trigger.flowId }}, and {{ trigger.namespace }} and attaching the failed execution context via executionId.Kestra's event-driven Flow trigger reacts to execution state changes the instant they happen, across every flow, something a single flow's own schedule cannot do. The declarative YAML keeps the alert rule version controlled and reviewable, the dependsOn entry's labels field gives you precise, label-based routing, and built-in retries plus full execution lineage mean alerts and their context are durable and auditable rather than fire-and-forget.
owner: john.doe).EMAIL_USERNAME: SMTP account username.EMAIL_PASSWORD: SMTP account password.EMAIL_USERNAME and EMAIL_PASSWORD secrets to your Kestra instance.to, from, host, and port values in the send_email task for your mail provider.labels in the trigger's dependsOn entry to match the flows you want to monitor.states such as WARNING or KILLED.owner plus team or env) in the labels field for tighter scoping.