Slack
Synopsis
Sends alert notifications to Slack channels using incoming webhooks, supporting message attachments with customizable colors, additional fields, and branding options.
Schema
- slack:
webhook_url: <string>
title: <string>
message: <string>
username: <string>
icon_url: <string>
icon_emoji: <string>
channel: <string>
color: <string>
fields: <field[]>
description: <text>
if: <script>
ignore_failure: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
| Field | Required | Default | Description |
|---|---|---|---|
webhook_url | N | ${SLACK_WEBHOOK_URL} | Slack incoming webhook URL |
title | Y | - | Message title displayed prominently |
message | Y | - | Main message body text |
username | N | VirtualMetric | Bot username displayed in Slack |
icon_url | N | VirtualMetric icon | URL to image used as bot avatar |
icon_emoji | N | - | Emoji to use as bot avatar (overrides icon_url) |
channel | N | - | Channel to post to (overrides webhook default) |
color | N | #47BEFF | Attachment color: good, warning, danger, info, or hex code |
fields | N | - | Array of field objects with title, value, and short fields |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
The slack processor sends notifications to Slack channels using incoming webhooks.
Webhook Setup: Create an incoming webhook in Slack:
- Go to your Slack workspace's App Directory
- Search for "Incoming Webhooks" and add it
- Choose a channel and create the webhook
- Copy the webhook URL
Colors: Visual severity indicators for the message attachment sidebar:
good/green/success: Green (#26A65B)warning/yellow: Orange (#FFB655)danger/red/error/critical: Red (#FB4946)info/blue: Blue (#47BEFF) - default- Custom hex codes (e.g.,
#FF5733) for brand colors
Fields: Structured data displayed in the attachment:
fields:
- title: "Server"
value: "{{ .hostname }}"
short: true
- title: "CPU"
value: "{{ .cpu_usage }}%"
short: true
Set short: true to display fields side-by-side.
Channel Override: The channel field overrides the webhook's default channel. Use #channel-name for public channels or @username for direct messages.
Template Support: All string fields support Go template syntax with event field interpolation using {{ .field_name }}.
For integration patterns with schema validation, see Schema Drift Detection.
Examples
Basic Alert
Sending a simple alert notification... | |
Red-colored alert posted to Slack... |
With Fields
Including structured data as fields... | |
Fields displayed side-by-side in attachment... |
Custom Username and Channel
Overriding bot identity and target channel... | |
Message posted as AlertBot to #alerts channel... |
Color Options
Using different severity colors... | |
Colors indicate severity at a glance... |
Schema Drift Alert
Alerting on schema validation failures... | |
Alert triggered automatically when schema drift detected... |