Skip to main content
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.

Step 1: Create a Slack Incoming Webhook

  1. Go to api.slack.com/apps
  2. Click Create New App → From scratch
  3. Name it DriftGuard Alerts and select your workspace
  4. Under Incoming Webhooks, toggle Activate Incoming Webhooks to On
  5. Click Add New Webhook to Workspace
  6. Select the channel (e.g. #data-alerts) and click Allow
  7. Copy the webhook URL — it looks like: https://hooks.slack.com/services/T.../B.../xxx

Step 2: Register the Webhook with DriftGuard

curl -s -X POST https://api.driftguard.dev/api/v1/webhooks \
  -H "X-API-Key: $DRIFTGUARD_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.slack.com/services/T.../B.../xxx",
    "events": ["breaking", "warning"],
    "contract_id": null
  }'
Save the id and secret from the response:
{
  "id": "your_webhook_id_here",
  "url": "https://hooks.slack.com/services/T.../B.../xxx",
  "events": ["breaking", "warning"],
  "contract_id": null,
  "active": true,
  "secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "created_at": "2026-03-01T19:22:00Z"
}
The secret is shown only once. Store it securely — you’ll need it to verify payloads if you add a middleware layer in Step 4.
To scope alerts to a single contract instead of all contracts, pass its id as contract_id:
-d '{
  "url": "https://hooks.slack.com/services/T.../B.../xxx",
  "events": ["breaking"],
  "contract_id": "your_contract_id_here"
}'

Step 3: What Arrives in Slack

When a check matches your events list, DriftGuard POSTs the check result JSON directly to your Slack webhook URL. Slack displays it as a code block:
{
  "id": "your_check_id_here",
  "contract_id": "your_contract_id_here",
  "result": "breaking",
  "severity": 70,
  "diff": {
    "removed": ["email"],
    "type_changes": [
      { "column": "created_at", "from": "timestamp", "to": "string" }
    ],
    "added": []
  },
  "credits_used": 1,
  "created_at": "2026-03-01T18:00:14Z"
}
DriftGuard will retry delivery up to 3 times (immediately, then after 5s, then after 25s) if Slack doesn’t return a 2xx response.

Step 4 (Optional): Format the Slack Message

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, jsonify
import requests
import hmac, hashlib

app = 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.

Stopping Alerts

To stop receiving Slack alerts, delete the webhook via the API:
curl -s -X DELETE https://api.driftguard.dev/api/v1/webhooks/your_webhook_id_here \
  -H "X-API-Key: $DRIFTGUARD_KEY"
To change which events trigger alerts, delete the existing webhook and create a new one with the updated events list.

Webhooks Guide

Full webhook documentation including signature verification and retry behaviour.

Create Webhook

Full API reference for registering webhooks.