Send DriftGuard check results to a Slack channel using Incoming Webhooks.
Get notified in Slack whenever a schema check returns breaking or warning.
DriftGuard delivers check results to any HTTPS endpoint — including Slack Incoming Webhooks.
DriftGuard delivers the raw check result JSON to your Slack webhook URL.
Slack will display this as a formatted code block. If you want rich Slack
message formatting (blocks, colours, fields), add a small middleware function
between DriftGuard and Slack — see Step 4
below.
To get rich Slack formatting, deploy a small function that receives the
DriftGuard payload and reformats it as a Slack Block Kit message before
forwarding to Slack.Here’s a minimal example using Python:
from flask import Flask, request, jsonifyimport requestsimport hmac, hashlibapp = Flask(__name__)SLACK_WEBHOOK = "https://hooks.slack.com/services/T.../B.../xxx"DRIFTGUARD_SECRET = "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"def verify(payload: bytes, sig: str) -> bool: expected = hmac.new( DRIFTGUARD_SECRET.encode(), payload, hashlib.sha256 ).hexdigest() return hmac.compare_digest(expected, sig)@app.route("/driftguard-hook", methods=["POST"])def hook(): if not verify(request.data, request.headers.get("X-DriftGuard-Signature", "")): return "Unauthorized", 401 data = request.json result = data.get("result", "unknown") severity = data.get("severity", 0) removed = data.get("diff", {}).get("removed", []) type_changes = data.get("diff", {}).get("type_changes", []) icon = "🔴" if result == "breaking" else "⚠️" if result == "warning" else "✅" text = ( f"{icon} *DriftGuard — {result.upper()}* (severity: {severity})\n" f"Contract: `{data.get('contract_id')}`\n" f"Check ID: `{data.get('id')}`\n" ) if removed: text += f"Removed columns: {', '.join(f'`{c}`' for c in removed)}\n" if type_changes: for tc in type_changes: text += f"Type changed: `{tc['column']}` {tc['from']} → {tc['to']}\n" requests.post(SLACK_WEBHOOK, json={"text": text}) return jsonify({"ok": True})
Point your DriftGuard webhook at this function’s URL instead of the Slack
webhook URL directly.