Blueprints

Error handling: send Slack alert on failure

Source

yaml
id: on-failure-alert
namespace: company.team

tasks:
  - id: fail
    type: io.kestra.plugin.scripts.shell.Commands
    taskRunner:
      type: io.kestra.plugin.core.runner.Process
    commands:
      - exit 1

errors:
  - id: slack
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}"
    payload: >
      {
        "channel": "#alerts",
        "text": "Failure alert for flow {{ flow.namespace }}.{{ flow.id }} with ID {{ execution.id }}"
      }

About this blueprint

DevOps Notifications

This flow will fail and the errors section declares tasks that should run on failure.

Commands

Process

Slack Incoming Webhook

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra