Stripe webhooks — alert on failed deliveries
Your `/stripe/webhook` endpoint started 500ing after a deploy — Stripe gave up after 5 retries. Payments lag a full 24h. We want a 60-sec alert.
Recipe
bash
#!/usr/bin/env bash
# Pulls last 100 webhook attempts; alerts on >= N failures.
STRIPE_KEY="${STRIPE_KEY:?must be set}"
THRESHOLD="${THRESHOLD:-3}"
JSON=$(curl -sS -u "$STRIPE_KEY:" \
"https://api.stripe.com/v1/events?limit=100")
FAILED=$(echo "$JSON" | python3 -c '
import json, sys
d = json.load(sys.stdin)
fail = sum(1 for e in d.get("data", []) if e.get("pending_webhooks", 0) > 0)
print(fail)
' 2>/dev/null)
[ -z "$FAILED" ] && { echo "parse-fail"; exit 1; }
[ "$FAILED" -ge "$THRESHOLD" ] && echo "high $FAILED" || echo "ok $FAILED"
Same thing in Enterno.io
Endpoint + Enterno HTTP monitor with "ok" keyword + Slack notifications = pager-grade coverage. Pair with the Security Scanner to verify your endpoint validates signatures.
Related recipes
Ensure your site returns 2xx every minute, alert to Slack/Telegram on failure.
Minimal script that checks an SSL certificate and alerts 14 days before expiry.
Detect the moment a replica falls behind the primary by more than 10 seconds.