> ## Documentation Index
> Fetch the complete documentation index at: https://docs.visent.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Configure webhook notifications for Visent events, alerts, and benchmark completion

# Webhooks

Receive real-time notifications from Visent services through webhooks for events like alert triggers, benchmark completion, and system status changes. Configure webhook endpoints to integrate Visent notifications with your existing workflow and monitoring systems.

Supports multiple webhook destinations with retry logic, authentication, and event filtering.

## Webhook Events

Coming soon - complete list of available webhook events and payloads.

## Configuration

### Creating Webhooks

```bash theme={null}
# Create a new webhook
POST /webhooks

# Example request
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/visent",
    "events": ["alert.triggered", "benchmark.completed"],
    "secret": "your_webhook_secret",
    "active": true
  }' \
  "https://api.visent.ai/webhooks"

# Example response
{
  "webhook_id": "wh_12345",
  "url": "https://your-app.com/webhooks/visent",
  "events": ["alert.triggered", "benchmark.completed"],
  "active": true,
  "created_at": "2024-01-15T10:30:00Z"
}
```

### Managing Webhooks

```bash theme={null}
# List webhooks
GET /webhooks

# Update webhook
PUT /webhooks/{webhook_id}

# Delete webhook
DELETE /webhooks/{webhook_id}
```

## Event Types

### Alert Events

```json theme={null}
{
  "event": "alert.triggered",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "alert_id": "alert_789",
    "name": "High GPU Temperature",
    "severity": "critical",
    "node": "gpu-worker-1",
    "gpu": 0,
    "metric": "temperature",
    "value": 87.5,
    "threshold": 85.0
  }
}
```

### Benchmark Events

Coming soon - benchmark completion and status change events.

### System Events

Coming soon - node status changes and system health events.

## Security

### Webhook Authentication

```python theme={null}
import hmac
import hashlib

def verify_webhook(payload, signature, secret):
    """Verify webhook signature"""
    expected = hmac.new(
        secret.encode('utf-8'),
        payload.encode('utf-8'),
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(signature, f"sha256={expected}")
```

### IP Allowlisting

Coming soon - IP address restrictions for webhook endpoints.

## Delivery

### Retry Policy

Coming soon - webhook delivery retry logic and backoff strategies.

### Delivery Logs

Coming soon - tracking webhook delivery status and debugging failures.

### Timeout Settings

Coming soon - configuring webhook timeout and reliability settings.

## Testing

### Webhook Testing

```bash theme={null}
# Test webhook delivery
POST /webhooks/{webhook_id}/test

# Send test event
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.visent.ai/webhooks/wh_12345/test"
```

### Event Simulation

Coming soon - simulating events for webhook testing and development.

## Troubleshooting

Coming soon - common webhook issues and debugging guide.

## Code Examples

### Python Flask Handler

```python theme={null}
from flask import Flask, request, jsonify
import hmac
import hashlib

app = Flask(__name__)

@app.route('/webhooks/visent', methods=['POST'])
def handle_webhook():
    payload = request.get_data(as_text=True)
    signature = request.headers.get('X-Visent-Signature')
    
    # Verify signature
    if not verify_webhook(payload, signature, WEBHOOK_SECRET):
        return jsonify({'error': 'Invalid signature'}), 401
    
    event = request.json
    
    # Handle different event types
    if event['event'] == 'alert.triggered':
        handle_alert(event['data'])
    elif event['event'] == 'benchmark.completed':
        handle_benchmark(event['data'])
    
    return jsonify({'status': 'received'})
```

## Next Steps

* [Set up authentication](authentication) for webhook management
* [Configure alerts](../telemetry/alerts) to trigger webhooks
* [Explore API endpoints](telemetry) for additional integration options
