Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt

Use this file to discover all available pages before exploring further.

A 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.
NamingValue
ObjectWebhook
Resource type (JSON:API type)webhook
Collection / records rootโ€” (not a records root)
REST base/v1/subscriptions/webhooks
Entity classWebhook
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

OperationMethod & pathStatus
ListGET /v1/subscriptions/webhooks๐ŸŸก Planned
RetrieveGET /v1/subscriptions/webhooks/{id}๐ŸŸก Planned
CreatePOST /v1/subscriptions/webhooks๐ŸŸก Planned
UpdatePATCH /v1/subscriptions/webhooks/{id}๐ŸŸก Planned
DeleteDELETE /v1/subscriptions/webhooks/{id}๐ŸŸก Planned

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
webhook_idstring (UUID) ๐Ÿ”’ systemโœ… YesUNIQUE; default gen_random_uuid()โ€”Public stable identifier for the webhook. Generated at creation; never changes.
target_urlstringโœ… Yesvarchar(255); must be a valid URL (Zod .url() at API boundary)โ€”The HTTPS endpoint to which the platform delivers event payloads via Cloud Tasks HTTP POST.
eventstring (enum)โœ… Yesvarchar(255); allowed values enforced by Zod schemadocument.processed | document.uploadedThe workspace event type that triggers delivery. Only one event type per webhook registration.
headersobject (JSONB) | nullโšช Nojsonb; nullable; key-value map of stringsโ€”Optional custom HTTP headers merged into the delivery request (e.g. Authorization, X-Source). Sent as-is by the platform.
activeboolean ๐Ÿ”’ systemโœ… Yesdefault trueโ€”Whether the webhook is currently enabled. Defaults to true on creation. Not exposed in the update schema โ€” cannot be toggled via the API.
created_atdatetime ๐Ÿ”’ systemโœ… Yestimestamptz; set by onCreate hookโ€”ISO 8601 timestamp of when the webhook was created.
updated_atdatetime ๐Ÿ”’ systemโšช Notimestamptz; nullable; set by onCreate and onUpdate hooksโ€”ISO 8601 timestamp of the last update. Null until first modification.
deleted_atdatetime ๐Ÿ”’ systemโšช Notimestamptz; nullableโ€”Soft-delete timestamp. When set, the webhook is excluded from all queries and no longer delivers events. Set by the DELETE endpoint.

Relationships

NameTypeRequiredDescription
workspaceto-one (ManyToOne)โœ… YesThe workspace that owns this webhook. All queries filter by workspace_pk. Parent-workspace webhooks also fire for child workspaces during delivery. References Workspace.

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

{
  "data": {
    "type": "webhook",
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "attributes": {
      "event": "document.processed",
      "target_url": "https://api.example.com/well-events",
      "headers": {
        "Authorization": "Bearer secret-token",
        "X-Source": "well"
      },
      "active": true,
      "created_at": "2026-03-15T10:30:00.000Z",
      "updated_at": "2026-04-01T08:00:00.000Z"
    }
  }
}
Source: apps/api/src/database/entities/Webhook.ts ยท domain: platform ยท tier: Platform