Flow icon
SlackExecution icon

Executes flow on flow trigger with ExecutionNamespace condition

Trigger Kestra flows based on execution namespace using the ExecutionNamespace condition. Automate cross-namespace workflow dependencies at scale.

Categories
Core
id: flow-condition-executionnamespace
namespace: company.team

triggers:
  - id: flow
    type: io.kestra.plugin.core.trigger.Flow
    dependsOn:
      - when: "{{ trigger.namespace startsWith 'company.engineering' }}"
        states:
          - FAILED

tasks:
  - id: send_slack_message
    type: io.kestra.plugin.slack.notifications.SlackExecution
    url: "{{ secret('SLACK_WEBHOOK') }}"
    executionId: "{{ trigger.executionId }}"
    payload: "The workflow execution {{ trigger.executionId }} failed for the flow
      {{ trigger.flowId }} in the namespace {{ trigger.namespace }}"

Get a Slack notification every time any workflow under a chosen namespace fails, without wiring an alert into each flow individually. This blueprint listens for failed executions across a whole namespace prefix and pushes a clear message to your incident channel, so platform and data teams catch broken pipelines the moment they break. It pairs the Kestra Flow trigger with a dependsOn when expression to deliver centralized, namespace-wide failure monitoring.

How it works

  1. The io.kestra.plugin.core.trigger.Flow trigger subscribes to executions happening elsewhere in your Kestra instance.
  2. The trigger's dependsOn when expression ({{ trigger.namespace startsWith 'company.engineering' }}) filters those executions to any namespace starting with company.engineering (for example company.engineering.etl or company.engineering.ml).
  3. The same dependsOn entry's states list is set to [FAILED], so this flow only runs when a matching execution fails.
  4. The send_slack_message task (io.kestra.plugin.slack.notifications.SlackExecution) posts the alert, interpolating {{ trigger.executionId }}, {{ trigger.flowId }}, and {{ trigger.namespace }} into the payload so the message names the exact failing execution.

What you get

  • One central alerting flow instead of duplicated notification logic in every workflow.
  • Slack messages that identify the failing flow, namespace, and execution ID.
  • Prefix-based matching that automatically covers new sub-namespaces as teams add them.
  • State filtering so you are paged only on FAILED, not on normal completions.

Who it's for

  • Platform engineers running a shared Kestra instance for many teams.
  • Data engineers who need fast notice when a pipeline in their domain breaks.
  • On-call and SRE teams routing orchestration failures into Slack.

Why orchestrate this with Kestra

A standalone scheduler can run jobs but cannot react to the outcome of other flows across namespaces. Kestra Flow triggers turn execution events into first-class triggers, so this alert fires the instant a failure happens, with no polling. The dependsOn when expression scopes monitoring declaratively in YAML, retries and execution history give you lineage on every alert, and the whole policy lives in one version-controlled flow rather than scattered across dozens of pipelines.

Prerequisites

  • A running Kestra instance with the Slack plugin available.
  • A Slack incoming webhook URL for the channel that should receive alerts.

Secrets

  • SLACK_WEBHOOK: the Slack incoming webhook URL used by the send_slack_message task.

Quick start

  1. Add the SLACK_WEBHOOK secret to your Kestra instance.
  2. Change the namespace prefix in the trigger's when expression from company.engineering to the namespace prefix you want to monitor.
  3. Save the flow and let a flow under that namespace fail (or fail one on purpose) to confirm the Slack alert arrives.

How to extend

  • Add more states such as WARNING to the trigger states list to widen coverage.
  • Change the when expression to an equality check ({{ trigger.namespace == 'company.engineering' }}) to monitor a single exact namespace.
  • Add tasks to open an incident, page on-call, or write the failure to a tracking table alongside the Slack message.
  • Enrich the payload with execution links or labels to speed up triage.

Links

Orchestrate with Kestra
Orchestrate Slack with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.