Blueprints

Failure notifications to Slack to monitor the health of production workflows

About this blueprint

Trigger Notifications

This flow sends a Slack alert any time a flow from the company.analytics namespace finishes with errors or warnings. Thanks to the executionId variable, the alert includes a link to the failed flow's execution page.

Given that this flow runs on a Flow trigger, there is no need for boilerplate code to define alert logic in each flow separately. Instead, the Flow trigger allows you to define that logic only once. The trigger will listen to the execution state of any flow in the company.analytics namespace, including all child namespaces, and will automatically send Slack messages on failure.

This flow assumes that you stored the Slack webhook URL as a secret.

yaml
id: slack_failure_alert
namespace: company.monitoring
tasks:
  - id: send
    type: io.kestra.plugin.notifications.slack.SlackExecution
    url: "{{ secret('SLACK_WEBHOOK') }}"
    channel: "#general"
    executionId: "{{ trigger.executionId }}"
triggers:
  - id: listen
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatusCondition
        in:
          - FAILED
          - WARNING
      - type: io.kestra.plugin.core.condition.ExecutionNamespaceCondition
        namespace: company.analytics
        prefix: true

Slack Execution

Flow

Execution Status Condition

Execution Namespace Condition

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra