Discord
The Discord notifier posts color-coded embeds to a channel through a Discord channel webhook. No bot to host: the webhook URL is all it needs.
[notifiers.discord-ops]type = "discord"webhook_url = "${DISCORD_OPS_URL}"Fields
Section titled “Fields”| Key | Required | What it does |
|---|---|---|
webhook_url |
yes | The webhook URL. Keep it out of the file; see Storing the secret. |
template_path |
no | A Go template file that replaces the built-in message. |
Creating the webhook
Section titled “Creating the webhook”- In your server, open Server Settings → Integrations → Webhooks and click New Webhook.
- Pick the channel (for example
#ops-alerts). - Set the name and avatar. Messages are posted under them.
- Click Copy Webhook URL. It looks like
https://discord.com/api/webhooks/1234567890/XXXXXXXXXXXXXXXXXXXX.
Anyone with the URL can post to your channel, so treat it as a secret. A webhook
belongs to one channel; for a second channel, create a second webhook and a
second [notifiers.*] block. Discord notifiers don’t accept a
discord-ops:<target> override.
What a message looks like
Section titled “What a message looks like”Each event is one embed. The color strip shows the outcome:
| Color | When |
|---|---|
| Red | failures, timeouts, crashes |
| Green | successes |
| Yellow | warnings, like low disk space |
| Blurple | everything else, like a run starting |
❌ backup-postgres failed
Exited with code 1 after 0.3s.Triggered via the REST API · 14 May, 17:11.
Error: connection refused dial tcp 127.0.0.1:5432: connect: connection refused
from runwisp · bright-falcon- The title links to the run when
external_urlis set. - The last lines of output appear for failures and timeouts, when there is a log.
- Mentions are turned off, so a task that prints
@everyonecan’t ping your whole server.
Changing the message
Section titled “Changing the message”Point template_path at your own Go template. Start from the built-in
discord.tmpl.json,
which has the embed layout and the color table. It gets the whole event and the
same helpers as the Slack template.
What’s rejected
Section titled “What’s rejected”- A missing or empty
webhook_url, or one that isn’thttp://orhttps://.