A Slack bot that lets you silence Prometheus Alertmanager alerts directly from Slack — reply s 1h in an alert's thread, or just type s 1h in the channel to silence whatever just paged.
Silencer integrates with Alertmanager to provide convenient alert silencing capabilities from Slack:
- Silence alerts for specified durations (years, months, weeks, days, hours, minutes)
- Check current silences for an alert
- Expire/delete silences manually
- Auto-extracts alert labels from the Alertmanager Slack attachment
- Talks to Alertmanager's HTTP API directly — the AM URL is read from the Slack alert's silence-button, so a single bot can manage silences across multiple Alertmanager instances
docker run -d --name silencer \
-e SLACK_APP_TOKEN=xapp-1-... \
-e SLACK_BOT_TOKEN=xoxb-... \
-p 3000:3000 \
ghcr.io/vtmocanu/silencer:v2.0.3Check the GHCR package page for the latest version. There is intentionally no :latest tag — pin a specific version.
Then invite the bot to your Alertmanager Slack channel and either reply s 1h in an alert's thread, or just type s 1h in the channel to silence the most recent alert.
To get the tokens, see Slack App Configuration below.
Silencer is configured entirely via environment variables:
| Variable | Required | Description |
|---|---|---|
SLACK_APP_TOKEN |
yes | App-Level Token for Socket Mode (starts with xapp-) |
SLACK_BOT_TOKEN |
yes | Bot User OAuth Token (starts with xoxb-) |
LOG_LEVEL |
no | Log level (debug, info, warn, error). Defaults to info. |
How you provide these is up to you — common options:
- Docker / docker-compose: pass with
-eor via an env-file - Kubernetes: store in a
Secretand reference viavalueFrom.secretKeyRef - Secret managers: External Secrets Operator, sealed-secrets, Infisical, Vault, AWS Secrets Manager — any tool that ultimately surfaces values as env vars works
Note: The Alertmanager URL is not configured via env var. Silencer extracts it from the silence-button URL on each Alertmanager Slack message.
The container exposes port 3000 for Prometheus metrics (/metrics) and a liveness probe (/healthz).
Invite the bot to your Alertmanager Slack channel:
/invite @Silencer
The bot listens in any channel it has been invited to and supports two ways to issue a command:
- Reply in an alert thread → the bot acts on that alert. Use this when you want to silence a specific alert that may not be the most recent one in the channel.
- Send a message directly in the channel (no thread) → the bot scans the last 20 messages, finds the most recent Alertmanager alert, and acts on that. Use this when you want to silence whatever just paged you, without scrolling up to open the thread.
In both cases the bot extracts alert labels from the Alertmanager Slack attachment and creates/manages silences via Alertmanager's HTTP API.
# Silence alerts
s 1h # Silence for 1 hour
s 30m # Silence for 30 minutes
silence for 2d # Silence for 2 days
s 1d 2h 30m # Silence for 1 day, 2 hours, 30 minutes
s 2w # Silence for 2 weeks
s 1mo # Silence for 1 month
# Check existing silences
check # Shows active silences for this alert
# Remove silences
expire # Delete all active silences for this alert
- Alertmanager posts an alert (in the screenshot:
[FIRING:3] [Z2M] Device Offline) - You either:
- Open the alert's thread and reply
s 10m(acts on that specific alert), or - Just type
s 10min the channel directly (acts on the most recent alert in the last 20 channel messages)
- Open the alert's thread and reply
- The bot replies in-thread with the silence ID, the matchers it derived from the alert labels, and the duration
- Later you can
checkin the same place to see remaining time, orexpireto lift the silence early
- ✅ Two ways to invoke: reply in an alert thread (precise), or post directly in the channel (acts on the most recent alert in the last 20 messages)
- ✅ Automatic label extraction: bot reads alert labels from the Alertmanager attachment's silence-button URL
- ✅ Multiple silences: can handle multiple active silences per alert
- ✅ Confirmation: always confirms actions with silence IDs
⚠️ Won't work in DMs: the bot only responds in channels it has been invited to⚠️ Channel-mode lookback is 20 messages: if the alert you want is older than that, reply in its thread instead
- Create a new Slack App at https://api.slack.com/apps
- Use the manifest from
Silencer_manifest.jsonto configure the app automatically - Install the app to your workspace
- Navigate to OAuth & Permissions in your Slack app settings
- Click the workspace install button to install the app to your Slack workspace
- Copy the Bot User OAuth Token (starts with
xoxb-) — this isSLACK_BOT_TOKEN
- Navigate to Basic Information → App-Level Tokens
- Click Generate Token and Scopes
- Give it a name (e.g., "Socket Mode Token")
- Add the
connections:writescope - Click Generate and copy the token (starts with
xapp-) — this isSLACK_APP_TOKEN
The bot requires the following OAuth scopes (automatically configured via the manifest):
app_mentions:read— read messages that mention the appchannels:history— view messages in public channelschat:write— send messagesgroups:history— view messages in private channelsim:history— view direct messagesusers.profile:read— view user profilesusers:read— view user informationmetadata.message:read— receive message metadatampim:history— view group direct messages
Build and run the container locally:
docker build -t silencer:local .
docker run --rm \
-e SLACK_APP_TOKEN=xapp-1-... \
-e SLACK_BOT_TOKEN=xoxb-... \
silencer:localOptional: a devbox.json is provided for reproducible local tooling (Node, ESLint, security scanners). If you have devbox installed:
devbox shellNote: npm scripts and a CI workflow are still being set up for this repository. Until then, use
docker buildand the linters/scanners fromdevbox shelldirectly. Contributions welcome — see issues.
This project uses semantic versioning with automatic releases triggered by conventional commits.
To trigger automatic releases, use conventional commit messages:
fix: corrected alert parsing logic
fix(deps): update dependencies
chore(deps): update dependenciesfeat: add support for regex silences
feat(bot): implement bulk silence operationsfeat!: redesigned command parsing structure
fix!: changed silence duration format
# Or with BREAKING CHANGE in the footer
feat: new alertmanager API integration
BREAKING CHANGE: removed support for legacy Slack message formatYou can also trigger a release manually via workflow dispatch with options to:
- Force a specific version bump (patch/minor/major)
- Perform a dry run
- Force a release even without conventional commits
Licensed under the Apache License, Version 2.0. See LICENSE.
