This guide shows how to connect AISentinel to downstream systems through webhooks, including a no-code n8n workflow and a generic signed webhook implementation. Webhooks enable automated responses to policy decisions, audit events, and proof availability.
| Event | Description | Typical Consumers |
|---|---|---|
policy.decision.created | Fired after every policy evaluation with decision metadata. | Incident response bots, analytics pipelines |
proof.ready | Sent when a cryptographic proof package is available. | Compliance automation, document management |
billing.quota.threshold | Triggered when usage hits configured thresholds. | FinOps alerts |
team.member.updated | Team management changes. | IAM synchronizers |
Webhook payloads include:
id, event, tenant, createdAtsignature header using HMAC-SHA256 with your shared secretauditId for correlation with Auditing & Compliance/aisentinel/events and method to POST.200 OK JSON response.Add a Function node with the following JavaScript to validate the HMAC signature:
const crypto = require('crypto');
const payload = JSON.stringify(items[0].json);
const signature = $json["headers"]["x-aisentinel-signature"];
const digest = crypto
.createHmac('sha256', $env.AISENTINEL_WEBHOOK_SECRET)
.update(payload)
.digest('hex');
if (digest !== signature) {
throw new Error('Signature mismatch');
}
return items;
policy.decision.created: Send Slack alerts for decision = "deny".proof.ready: Download proof using the API and archive in SharePoint.billing.quota.threshold: Create a Jira ticket for FinOps review.Refer to the Remediation Automation guide for full incident workflows.
from fastapi import FastAPI, Header, HTTPException, Request
import hmac
import hashlib
import httpx
import os
app = FastAPI()
WEBHOOK_SECRET = os.environ["AISENTINEL_WEBHOOK_SECRET"]
async def verify_signature(payload: bytes, signature: str) -> None:
digest = hmac.new(WEBHOOK_SECRET.encode(), payload, hashlib.sha256).hexdigest()
if not hmac.compare_digest(digest, signature):
raise HTTPException(status_code=401, detail="invalid_signature")
@app.post("/webhooks/aisentinel")
async def handle_webhook(request: Request, x_aisentinel_signature: str = Header("")):
body = await request.body()
await verify_signature(body, x_aisentinel_signature)
event = await request.json()
match event["event"]:
case "policy.decision.created":
if event["data"]["decision"] == "deny":
await httpx.post("https://pagerduty.example.com", json={
"summary": "AISentinel policy denial",
"severity": "high",
"source": event["tenant"],
"custom_details": event["data"],
})
case "proof.ready":
proof_id = event["data"]["proofId"]
# Download proof using tenant-scoped API key
case _:
pass
return {"status": "ok"}
retry metadata to distinguish retried deliveries.event and deliveryId for correlation. Send failures to your SIEM as described in Auditing & Compliance.ngrok or cloudflared tunnels with caution and temporary secrets.Combine webhooks with agent integrations such as LangChain or CrewAI to orchestrate end-to-end remediation and compliance workflows.