# Webhook Events

# Webhook Events

Amdahl delivers event callbacks via HTTP POST. Each delivery carries an
`X-Amdahl-Signature` header computed as `sha256=<hex-hmac>` over the raw
body using your webhook secret.

## Verifying a webhook

```ts
import { createHmac, timingSafeEqual } from 'node:crypto'

export function verifyWebhook(rawBody: string, signatureHeader: string, secret: string): boolean {
  const expected = createHmac('sha256', secret).update(rawBody).digest('hex')
  const received = signatureHeader.replace(/^sha256=/, '')
  const a = Buffer.from(expected, 'hex')
  const b = Buffer.from(received, 'hex')
  if (a.length !== b.length) return false
  return timingSafeEqual(a, b)
}
```

## Event catalog

## `artifact.created`

**Trigger.** Emitted after a new platform_artifact is saved.

**Payload.**

```json
{
  "event": "artifact.created",
  "business_id": "550e8400-e29b-41d4-a716-446655440000",
  "artifact": {
    "id": "00000000-0000-0000-0000-000000000001",
    "artifact_type": "battlecard",
    "title": "New Battlecard",
    "status": "draft",
    "current_version": 1
  },
  "timestamp": "2026-04-14T12:00:00.000Z"
}
```

## `artifact.updated`

**Trigger.** Emitted after an existing artifact is edited (new version row created).

**Payload.**

```json
{
  "event": "artifact.updated",
  "business_id": "550e8400-e29b-41d4-a716-446655440000",
  "artifact_id": "00000000-0000-0000-0000-000000000001",
  "version": 2,
  "change_summary": "Edited outline section",
  "timestamp": "2026-04-14T12:05:00.000Z"
}
```

## `artifact.status_changed`

**Trigger.** Emitted when artifact.status transitions (draft -> saved, saved -> archived, etc).

**Payload.**

```json
{
  "event": "artifact.status_changed",
  "business_id": "550e8400-e29b-41d4-a716-446655440000",
  "artifact_id": "00000000-0000-0000-0000-000000000001",
  "previous_status": "draft",
  "new_status": "saved",
  "timestamp": "2026-04-14T12:10:00.000Z"
}
```

## `session.completed`

**Trigger.** Emitted when a platform session is marked complete.

**Payload.**

```json
{
  "event": "session.completed",
  "business_id": "550e8400-e29b-41d4-a716-446655440000",
  "session_id": "plat_550e8400-e29b-41d4-a716-446655440000",
  "duration_ms": 58000,
  "timestamp": "2026-04-14T12:15:00.000Z"
}
```
