Webhook represents an outbound HTTP subscription registered by a workspace. When a watched event fires (e.g. document.processed, document.uploaded), the platform enqueues a Cloud Tasks HTTP POST to target_url carrying the event payload and any caller-supplied custom headers. One workspace may register multiple webhooks; parent-workspace webhooks also fire for child workspaces. Webhooks are soft-deleted and workspace-scoped.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.
API operations
Data model
Attributes
Relationships
System-computed
- webhook_id โ gen_random_uuid() at insertion; also written by WebhookService.createWebhook via crypto.randomUUID() (redundant but consistent)
- created_at โ set by onCreate hook (new Date())
- updated_at โ set by onCreate and onUpdate hooks; null until first update
- deleted_at โ set to new Date() by WebhookService.deleteWebhook on soft-delete; not a MikroORM hook, explicit assignment
- active โ defaults to true at ORM level; no toggle exposed via API
- Deduplication guard โ WebhookService.createWebhook checks for an existing non-deleted webhook with the same (target_url, event, workspace) triple before inserting; raises WEBHOOK_ALREADY_EXISTS on collision
- Delivery via Cloud Tasks โ sendWebhookRequest dispatches through CloudTasksService.createHttpPostTask with taskId webhook-trigger---; the actual HTTP call is async and not reflected back on the entity
- idx_webhooks_workspace_deleted โ composite partial index on (workspace_pk, deleted_at) added by Migration20260416000000 for hot-path list queries
Example
apps/api/src/database/entities/Webhook.ts ยท domain: platform ยท tier: Platform