New to Kestra?
Use blueprints to kickstart your first workflows.
Centralize rich Slack alerting in one Kestra subflow that renders a Block Kit payload with header and mrkdwn section, safely JSON escaped via toJson.
Upgrade your pipeline alerts from plain text to rich, structured Slack messages, and maintain the formatting in exactly one place. This Kestra blueprint is a reusable subflow: any pipeline calls it with a header and a text body, and it renders a Slack Block Kit payload with a bold header block and an mrkdwn section, then posts it through an incoming webhook. Both inputs pass through the toJson filter, so multi line error messages, quotes, and special characters never break the JSON payload, a classic failure mode of hand built Slack alerts.
header (defaults to Pipeline Alert) and text, the message body which supports Slack mrkdwn formatting.slack_payload variable holds the Block Kit JSON template with a header block and a section block. Inputs are injected with {{ inputs.header | toJson }} and {{ inputs.text | toJson }}, which serializes them as safely escaped JSON strings.{{ renderOnce(vars.slack_payload) }} to expand the template exactly one time with the caller's inputs.log task (io.kestra.plugin.core.log.Log) writes the final payload to the execution logs, which makes debugging formatting issues trivial.slack task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts the rendered payload to the webhook URL stored as a secret.io.kestra.plugin.core.flow.Subflow, typically from an errors block, passing the failure context as the text input.toJson, so stack traces and quotes cannot corrupt the payload.renderOnce pattern for building complex templated payloads in flow variables.Copy pasting webhook tasks into every flow guarantees drift: some alerts get the new format, others keep the old one, and each copy escapes JSON slightly differently. Kestra subflows turn the alert into a versioned, callable unit with typed inputs. The variable plus renderOnce pattern keeps the Block Kit template readable, the secret store keeps the webhook out of source, and every alert sent is itself an execution you can inspect and replay.
text input.SLACK_WEBHOOK: the Slack incoming webhook URL used by SlackIncomingWebhook.SLACK_WEBHOOK secret to your Kestra namespace.text value to confirm the channel and formatting.errors block with an io.kestra.plugin.core.flow.Subflow task targeting this flow's id and namespace, passing text and optionally header.severity input that switches header wording or emoji per level.context block with the execution id and a deep link to the Kestra UI.image or divider block to the payload for richer layouts.