DiscordExecution icon
Flow icon
ExecutionStatus icon

Set up alerts for failed workflow executions using Discord

Automatically post a Discord message whenever a Kestra workflow execution fails or warns. One central system flow watches every execution, no per-flow setup.

Categories
CoreInfrastructureSystem
id: failure-alert-discord
namespace: system

tasks:
  - id: send_alert
    type: io.kestra.plugin.discord.DiscordExecution
    url: "{{ secret('DISCORD_WEBHOOK') }}"
    executionId: "{{ trigger.executionId }}"

triggers:
  - id: on_failure
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatus
        in:
          - FAILED
          - WARNING

Catch every failed or degraded workflow run the moment it happens by posting a notification to a Discord channel. This Kestra system flow centralizes failure alerting across your entire instance: instead of wiring notifications into each individual workflow, you define the alerting logic once and it watches every execution. When any flow ends in a FAILED or WARNING state, your team sees it in Discord, with a direct link back to the failing execution for fast triage and incident response.

How it works

  • A io.kestra.plugin.core.trigger.Flow trigger listens to executions across the instance. It uses an io.kestra.plugin.core.condition.ExecutionStatus condition that matches when the status is in FAILED or WARNING.
  • When the condition matches, the send_alert task of type io.kestra.plugin.discord.DiscordExecution posts a message to your Discord channel through an incoming webhook (url).
  • The task passes {{ trigger.executionId }} so the alert is tied to the exact execution that failed, giving your team a clickable path straight to the run that broke.

What you get

  • Real-time Discord notifications for failed and warning executions.
  • One central place to manage alerting, rather than alert tasks scattered across dozens of flows.
  • Execution context (the failing executionId) delivered with every alert.
  • A foundation you can extend with richer message formatting, mentions, or extra notification channels.

Who it's for

  • Platform and data engineering teams running many workflows who need a single, reliable failure signal.
  • On-call engineers who live in Discord and want incidents surfaced where they already work.
  • Small teams that want production-grade alerting without standing up a separate monitoring stack.

Why orchestrate this with Kestra

Discord webhooks alone have no awareness of your pipelines: they only post what you send them. Kestra supplies the missing piece. The event-driven Flow trigger reacts to execution state changes across the whole instance with no polling, so a single declarative YAML flow replaces alert code copied into every workflow. You get retries on the notification task, full execution lineage linking the alert back to the failing run, and centralized governance of who gets alerted and when. That is orchestration logic Discord's own tooling cannot provide.

Prerequisites

  • A running Kestra instance with the Discord plugin available.
  • A Discord channel with an incoming webhook URL.

Secrets

  • DISCORD_WEBHOOK: the Discord incoming webhook URL the send_alert task posts to.

Quick start

  1. In Discord, create an incoming webhook for the target channel and copy its URL.
  2. Store that URL as the DISCORD_WEBHOOK secret in Kestra.
  3. Add this flow to the system namespace (or your configured system namespace).
  4. Trigger any test flow to fail, then confirm the alert lands in your Discord channel.

How to extend

  • Restrict alerting to specific namespaces by adding an ExecutionNamespaceCondition to the trigger.
  • Customize the message body, add role or user mentions, or include labels and tenant context.
  • Add parallel notification tasks (email, Slack, PagerDuty) so one trigger fans out to multiple channels.
  • Filter further by execution labels to route alerts to different channels per team.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.