Webhooks API
Configure webhooks for real-time notifications.
List Webhooks
http
GET /api/v1/webhooksResponse
json
{
"data": [
{
"id": "whk_abc123",
"url": "https://your-server.com/webhook",
"events": ["deployment.completed", "alert.triggered"],
"active": true,
"created_at": "2025-01-15T10:00:00Z"
}
]
}Create Webhook
http
POST /api/v1/webhooksRequest Body
json
{
"url": "https://your-server.com/webhook",
"events": ["deployment.completed", "deployment.failed", "alert.triggered"],
"secret": "your-webhook-secret"
}Available Events
| Event | Description |
|---|---|
deployment.started | Deployment has started |
deployment.completed | Deployment completed successfully |
deployment.failed | Deployment failed |
alert.triggered | Alert condition met |
alert.resolved | Alert condition cleared |
service.created | New service added |
service.deleted | Service removed |
service.status_changed | Service health changed |
Update Webhook
http
PATCH /api/v1/webhooks/:idDelete Webhook
http
DELETE /api/v1/webhooks/:idTest Webhook
http
POST /api/v1/webhooks/:id/testWebhook Payload
All webhooks receive a JSON payload:
json
{
"id": "evt_xyz789",
"event": "deployment.completed",
"timestamp": "2025-01-15T10:00:00Z",
"data": {
"deployment_id": "dpl_abc123",
"service": "api-gateway",
"version": "v2.4.1",
"status": "success"
}
}Signature Verification
Webhooks include a signature header for verification:
X-OpsAtlas-Signature: sha256=abc123...Verify in your code:
javascript
const crypto = require('crypto');
function verifySignature(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return `sha256=${expected}` === signature;
}