Notification channels
Send a firing or resolved alert to your team's Slack or Discord, or to your own system, as well as by email. Available on Pro and up.
Set one up#
On the Alerts page, someone with alerts.manage adds a destination: Slack, Discord or a webhook. Each enabled channel receives every firing and resolved alert, in addition to the email. Any member who can read alerts can see the channels, but never the address. Pro includes 2 channels and Business 10. Channels you already have keep delivering after a downgrade; adding one needs the plan.
Alerts only, for now
Only alert firing and resolving are sent to channels. Release approvals and failures are still email only.
How the address is protected#
- The address is a secret. It is stored encrypted and bound to your organization. Only a hint (the host and the last four characters of the path) is ever shown or audited.
- Outbound calls are locked down: https only, port 443, no credentials. Slack and Discord addresses must be on their own hosts, and a generic webhook must be a public host name.
- The host is resolved first, and an answer that is private, loopback, link-local, reserved or multicast is refused. The connection goes to the address that was checked, redirects are never followed, and the call times out after 5 seconds.
Verify a webhook#
Each webhook request is signed so you can trust where it came from. The signing secret is shown once, when the channel is added.
| Header | Description |
|---|---|
| X-FlagSwift-Event | The event type. |
| X-FlagSwift-Timestamp | When it was sent. Reject one that is too old. |
| X-FlagSwift-Signature | sha256= followed by the hex HMAC-SHA256 of <timestamp>.<body>, using your channel's secret. |
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(rawBody: string, headers: Headers, secret: string) {
const timestamp = headers.get("x-flagswift-timestamp") ?? "";
const signature = headers.get("x-flagswift-signature") ?? "";
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; // too old
const expected = "sha256=" + createHmac("sha256", secret).update(timestamp + "." + rawBody).digest("hex");
const a = Buffer.from(signature);
const b = Buffer.from(expected);
return a.length === b.length && timingSafeEqual(a, b);
}The timestamp is in Unix seconds. Verify against the raw body, before any JSON parsing.
When something fails#
A broken channel never gets in the way. It shows “Failing” with when, plus a short reason (never the address), while alerting and email carry on. A test message can be sent at most every 10 seconds per channel. Without the operator's CHANNEL_ENCRYPTION_KEY, channels cannot be added and the console says so.
Not available yet#
Events beyond alert firing and resolving. On the Enterprise edition there is no per-organization channel, only one operator-wide webhook (ALERT_WEBHOOK_URL), which on a shared Commercial service is left unset.