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

# Webhooks

> Receive real-time notifications of CodeThreat events

Configure webhooks to receive real-time notifications when events occur in CodeThreat.

## Create Webhook

<Steps>
  <Step title="Navigate to Webhooks">
    **Organization Settings** → **Webhooks**
  </Step>

  <Step title="Create Webhook">
    Click **Create Webhook**
  </Step>

  <Step title="Configure">
    Set webhook properties:

    * **URL**: Your endpoint URL
    * **Events**: Which events to receive
    * **Secret**: Optional signing secret
  </Step>

  <Step title="Save">
    Click **Create**
  </Step>
</Steps>

## Available Events

**scan.completed**: Scan finished

**scan.failed**: Scan encountered error

**violation.created**: New violation found

**violation.fixed**: Violation marked as fixed

**repository.connected**: Repository added

**member.invited**: Team member invited

**member.added**: Team member joined

## Webhook Payload

Example payload:

```json theme={null}
{
  "event": "scan.completed",
  "timestamp": "2024-03-15T14:32:18Z",
  "data": {
    "scan_id": "scan_123",
    "repository": "myapp",
    "status": "COMPLETED",
    "violations": {
      "critical": 2,
      "high": 5,
      "medium": 12,
      "low": 8
    }
  }
}
```

## Verify Webhook Signatures

Verify webhooks using HMAC signature:

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

def verify_signature(payload, signature, secret):
    expected = hmac.new(
        secret.encode(),
        payload.encode(),
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(expected, signature)
```

## What's Next?

<CardGroup cols={2}>
  <Card title="API Keys" icon="key" href="/automation/api-keys">
    Create API keys
  </Card>

  <Card title="CI/CD Integration" icon="circle-nodes" href="/automation/ci-cd-integration">
    Integrate with CI/CD
  </Card>
</CardGroup>
