Webhooks API (Deprecated)
⚠️
Deprecated: This page documents only the webhook endpoints. See the comprehensive Webhooks & Notifications page for the full API including notification rules and channels.
Receive real-time notifications when events occur in ThinkHive.
List Webhooks
GET /api/v1/explainer/webhooksResponse:
{
"success": true,
"data": [
{
"id": "wh_001",
"url": "https://your-app.com/webhooks/thinkhive",
"events": ["trace.failure", "cluster.new"],
"status": "active",
"createdAt": "2024-01-15T10:00:00Z"
}
]
}Create Webhook
POST /api/v1/explainer/webhooksRequest Body:
{
"url": "https://your-app.com/webhooks/thinkhive",
"events": ["trace.failure", "cluster.new", "fix.proposed"],
"secret": "your_webhook_secret"
}Response:
{
"success": true,
"data": {
"id": "wh_002",
"url": "https://your-app.com/webhooks/thinkhive",
"events": ["trace.failure", "cluster.new", "fix.proposed"],
"status": "active"
}
}Update Webhook
PATCH /api/v1/explainer/webhooks/:idDelete Webhook
DELETE /api/v1/explainer/webhooks/:idTest Webhook
POST /api/v1/explainer/webhooks/:id/testResponse:
{
"success": true,
"data": {
"delivered": true,
"responseCode": 200,
"latencyMs": 150
}
}Available Events
| Event | Description |
|---|---|
trace.success | Trace completed successfully |
trace.failure | Trace failed |
cluster.new | New failure cluster created |
cluster.grown | Existing cluster grew significantly |
fix.proposed | New fix proposed |
fix.applied | Fix was applied |
shadow_test.completed | Shadow test finished |
eval.completed | Evaluation run completed |
drift.detected | Model drift detected |
Webhook Payload
{
"event": "trace.failure",
"timestamp": "2024-01-15T10:00:00Z",
"data": {
"traceId": "tr_xyz789",
"agentId": "agent_abc123",
"failureReason": "Hallucination detected",
"severity": "high"
}
}Signature Verification
Verify webhook signatures using HMAC-SHA256:
import crypto from 'crypto';
function verifySignature(payload: string, signature: string, secret: string) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(`sha256=${expected}`)
);
}Retry Policy
- Failed webhooks retry up to 5 times
- Exponential backoff: 1min, 5min, 30min, 2hr, 24hr
- Webhook disabled after 5 consecutive failures