Discord

Post approval requests, bypass requests, release updates and break-glass restores to Discord channels through channel webhooks, choose which channel gets what, and what Wardn does when Discord is down or a webhook is deleted.

Connect Discord channels and Wardn posts an embed to each one when a snapshot needs approvals, someone asks for a bypass, a release is raised or changes state, or someone restores past the guardrails during an incident. The embed's colour is the severity (blue, amber, red); it has the deployment, the environment, who asked and the short commit (seven characters), and its title and a last line link to the item in Wardn.

Nobody approves from Discord. A channel webhook can only receive messages and cannot carry buttons, so the embed links to Wardn, where a signed-in person approves under the usual rules. When a request is decided or superseded, Wardn posts a short closing embed to the channels that got the request.

Connect a channel

You need integration:manage (Owners and Admins) and a server with WARDN_SECRET_MASTER_KEY set, because the webhook URL is a secret: whoever has it can post to the channel. Wardn keeps it in its secret store and never shows it again, lists it or logs it. The page shows the host and the last four characters.

  1. In Discord, open the channel's settings, then Integrations, Webhooks, create a webhook and copy its URL.
  2. In Wardn, open Settings, Integrations, Discord, choose Add channel, name it, paste the URL and choose which events it takes.
  3. Choose Test. Wardn posts an embed that says it is a test.

Or with the API:

curl -fsS -X POST "$WARDN_API_URL/api/v1/integrations/chat-webhooks/discord/channels" \
  -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
  -d '{"name":"#deploys","webhookUrl":"https://discord.com/api/webhooks/…","rules":{"events":["approval.requested","bypass.requested"],"environments":[],"teams":[],"minSeverity":"warning"}}'

There can be 20 Discord channels, each with its own name.

Which addresses Wardn accepts

Only https://discord.com/api/webhooks/… and https://discordapp.com/api/webhooks/…, on the standard port, with no query, user name, fragment or redirects. Anything else is refused when you connect it, and again before each post. A host that resolves to a loopback, link-local, private or cloud metadata address is refused when Wardn connects.

Posts turn mentions off, so text in a request's reason cannot ping @everyone or a role.

Which channel gets what

A channel with no rules takes every event. With rules it takes the events that match all of them; an empty list matches everything. The rules are the same as for Microsoft Teams: events, environments, teams and the least urgent event. A closing embed goes only to the channels that got the request.

When something goes wrong

  • Discord is slow, down or rate limiting. A 429 carries Retry-After; a wait of up to five seconds is slept through and retried at once, a longer one is left to the queue, which waits at least that long. Other failures are retried with growing waits, up to eight tries.
  • The webhook was deleted or revoked (401, 403, 404). Trying again cannot help, so the card is dead-lettered at once and counted on the Integrations page, and the channel shows Last post failed. Paste a new URL (Edit) to clear it.
  • One channel failing does not stop the others, and each channel gets an event once.
  • Pause a channel to stop posting to it; Disconnect removes it and its URL.

Wardn clips text to Discord's limits: a title of 250 characters, 2,000 of text and ten facts, which is far under the 6,000 an embed may hold.

What is real and what is not

The provider is tested against a fake Discord endpoint, not against Discord. The server also has a fake provider that posts nowhere, for tests and demos.

On this page