Skip to content

Slack — alert when an incoming webhook is broken

All alerts go to Slack — but if the webhook URL is revoked / 404 / a Slack incident, you don't find out precisely because the alerts can't reach you (failure-of-failure).

Recipe

bash
#!/usr/bin/env bash
# /etc/cron.d/slack-self-test
# */5 * * * * root /opt/slack-self-test.sh

WEBHOOK=${SLACK_WEBHOOK}
ALT=${HEARTBEAT_URL}                 # different channel/transport

CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$WEBHOOK" \
  -H 'Content-Type: application/json' \
  --data '{"text":"silent self-test","username":"healthcheck"}')

# 200 = ok. 4xx = revoked/misconfigured. 5xx / curl error = Slack down.
if [ "$CODE" != "200" ]; then
  curl -fsS "$ALT" --data "slack_code=$CODE,webhook_failing=true"
  exit 2
fi
echo "OK (Slack returned $CODE)"

Same thing in Enterno.io

Use Enterno heartbeat as a fallback transport — if Slack 502s, alerts are not lost (Telegram + email + webhook to a different endpoint run independently).

Set up HTTP monitor → ← All recipes

Related recipes

Stripe, GitHub, Twilio return X-RateLimit-Remaining in response headers. If the backend does not track the floor, you get a sudden 429 and billing stops.