Blueprints

Send a Discord message when a production workflow fails

Source

yaml
id: discord-alert
namespace: company.team

tasks:
  - id: send_discord_message
    type: io.kestra.plugin.notifications.discord.DiscordExecution
    url: "{{ secret('DISCORD_WEBHOOK') }}"
    username: Rick Astley
    embedList:
      - title: Kestra Flow Notification
        color:
          - 255
          - 255
          - 255
    executionId: "{{ trigger.executionId }}"

triggers:
  - id: failed_prod_workflows
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatus
        in:
          - FAILED
          - WARNING
      - type: io.kestra.plugin.core.condition.ExecutionNamespace
        namespace: company.analytics
        prefix: true

About this blueprint

Notifications

This flow implements a namespace-level monitoring for all workflows in the namespace company.analytics. Whenever an execution in that namespace fails, this flow will automatically send a message to a Discord channel. This means that you don't need any boilerplate code to implement alerting logic. You only need to implement that once and thanks to the Flow trigger, Kestra will make sure that all executions matching the conditions will receive notifications. To use this flow, you need to create a Discord webhook and store it as a Secret. Follow this guide on Discord to create a webhook.

Discord Execution

Flow

Execution Status

Execution Namespace

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra