New to Kestra?
Use blueprints to kickstart your first workflows.
Trigger a Slack alert when a Kestra workflow fails. A simple, reusable failure notification pattern for monitoring production pipelines.
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.slack.notifications.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
messageText: "Failure alert for flow {{ flow.namespace }}.{{ flow.id }} with ID
{{ execution.id }}"
Get notified in Slack the moment a workflow breaks. This blueprint shows the Kestra error-handling pattern: a flow runs its normal tasks, and if anything fails, the errors block fires a Slack message that names the namespace, flow ID, and execution ID so on-call engineers can jump straight to the failed run. It turns silent pipeline failures into actionable alerts and gives any team a reusable, copy-paste failure notification pattern for production monitoring.
fail is an io.kestra.plugin.scripts.shell.Commands task running on the io.kestra.plugin.core.runner.Process runner. Here it simply runs exit 1 to simulate a failure, standing in for whatever real work your pipeline does.errors block.slack of type io.kestra.plugin.slack.notifications.SlackIncomingWebhook posts to an incoming webhook URL pulled from a secret.messageText is templated with Pebble expressions ({{ flow.namespace }}, {{ flow.id }}, {{ execution.id }}) so each alert carries the exact context needed to find and debug the failed execution.errors pattern you can paste into any flow.Slack has no idea your pipeline failed. Kestra closes that gap. The declarative errors block runs only on failure, with no extra cron job or babysitting script, and the alert is wired directly to execution lineage so the message links back to the exact run. Combine it with task retries to alert only after retries are exhausted, attach event triggers to chain recovery flows, and keep the whole pattern as version-controlled YAML that any team can reuse.
SLACK_WEBHOOK: the Slack incoming webhook URL used by the slack error task.SLACK_WEBHOOK secret in your Kestra instance.fail task runs exit 1, so the run fails on purpose.fail task with your real pipeline logic and keep the errors block as-is.retries to your tasks so alerts fire only after retries are exhausted.messageText to add run duration, the failing task ID, or a direct link to the execution.SlackIncomingWebhook for a richer Slack message task to post formatted blocks and buttons.