Skip to main content

Data Models

This page documents the core data structures used throughout the Dispatch API.

Project

{
"id": "uuid",
"user_id": "uuid",
"name": "My Project",
"slug": "my-project",
"header_prefix": "dispatch",
"created_at": "2025-03-14T10:00:00Z",
"updated_at": "2025-03-14T10:00:00Z",
"archived_at": null
}
FieldTypeDescription
idUUIDUnique project identifier
user_idUUIDOwning user
namestringDisplay name
slugstringURL-safe identifier
header_prefixstringPrefix for outgoing X-{prefix}-* headers
archived_attimestampSoft delete timestamp (null if active)

WebhookEndpoint

{
"id": "uuid",
"project_id": "uuid",
"name": "GitHub Webhooks",
"slug": "github-webhooks",
"signing_secret": null,
"event_type_path": "action",
"is_active": true,
"provider": "github",
"provider_repo": "owner/repo",
"provider_webhook_id": "123456",
"oauth_connection_id": "uuid",
"created_at": "2025-03-14T10:00:00Z",
"updated_at": "2025-03-14T10:00:00Z"
}
FieldTypeDescription
idUUIDUnique endpoint identifier
project_idUUIDParent project
namestringDisplay name
slugstringURL slug for POST /hooks/:slug
signing_secretstringVerification secret (hidden in responses)
event_type_pathstringDot-notation path to extract event type from body
is_activebooleanWhether the endpoint accepts requests
providerstring"github", "gitlab", "bitbucket", "slack", "jira", "linear", "stripe", or null
provider_repostringRepository/project identifier (provider-specific)
provider_webhook_idstringExternal webhook ID registered on the provider
oauth_connection_idUUIDLinked OAuth connection

Destination

{
"id": "uuid",
"project_id": "uuid",
"name": "Discord #alerts",
"type": "discord",
"guild_id": "123456789",
"channel_id": "987654321",
"retry_policy": {
"max_attempts": 7,
"backoff": [1, 5, 30, 120, 900, 3600, 21600]
},
"event_types": ["push", "pull_request"],
"is_active": true,
"created_at": "2025-03-14T10:00:00Z",
"updated_at": "2025-03-14T10:00:00Z"
}
FieldTypeDescription
idUUIDUnique destination identifier
project_idUUIDParent project
namestringDisplay name
typestring"discord", "slack", "telegram", or "webhook"
guild_idstringDiscord server ID
channel_idstringDiscord/Slack channel ID, or Telegram chat ID (e.g., @mychannel or -1001234567890)
retry_policyobjectRetry configuration
event_typesstring[]Event type allowlist (empty = all)
is_activebooleanWhether delivery is enabled
{
"endpoint_id": "uuid",
"destination_id": "uuid",
"template_id": "uuid",
"transform_id": "uuid",
"routing_rules": [],
"header_prefix": "dispatch"
}
FieldTypeDescription
endpoint_idUUIDLinked endpoint
destination_idUUIDLinked destination
template_idUUIDDefault message template (optional)
transform_idUUIDNamed Transform to apply before formatting; unset to disable (optional)
routing_rulesarrayConditional template/transform rules
header_prefixstringFrom project config

MessageTemplate

Templates support two config versions. The config field stores either a v1 flat object or a v2 multi-platform object.

v1 (flat):

{
"id": "uuid",
"project_id": "uuid",
"name": "GitHub Push Template",
"config": {
"title": "{{.Meta.EventType}}",
"description": "{{.Body.repository.full_name}}",
"color": 15105570,
"fields": [],
"footer": "Dispatch",
"timestamp": true
},
"created_at": "2025-03-14T10:00:00Z",
"updated_at": "2025-03-14T10:00:00Z"
}

v2 (multi-platform):

{
"id": "uuid",
"project_id": "uuid",
"name": "Multi-Platform Template",
"config": {
"version": 2,
"platforms": {
"discord": {
"title": "{{.Meta.EventType}}",
"description": "{{.Body.repository.full_name}}",
"color": 5763719,
"timestamp": true
},
"slack": {
"slack_blocks": [
{
"type": "section",
"text": { "type": "mrkdwn", "text": "*{{.Meta.EventType}}*" }
}
]
},
"telegram": {
"telegram_html": "<b>{{.Meta.EventType}}</b>\n{{.Body.repository.full_name}}"
},
"default": {
"title": "{{.Meta.EventType}}",
"timestamp": true
}
}
},
"created_at": "2025-03-14T10:00:00Z",
"updated_at": "2025-03-14T10:00:00Z"
}

See Message Templates for the full template config reference.

Transform

{
"id": "uuid",
"project_id": "uuid",
"name": "Extract PR fields",
"expression": "{ \"action\": action, \"title\": pull_request.title, \"url\": pull_request.html_url }",
"created_at": "2025-03-14T10:00:00Z",
"updated_at": "2025-03-14T10:00:00Z"
}
FieldTypeDescription
idUUIDUnique transform identifier
project_idUUIDParent project
namestringDisplay name
expressionstringJSONata expression

Event

{
"id": "uuid",
"endpoint_id": "uuid",
"organization_id": "uuid",
"event_type": "push",
"payload": {},
"headers": {},
"source_ip": "192.168.1.1",
"idempotency_key": null,
"status": "received",
"created_at": "2025-03-14T10:00:00Z"
}
FieldTypeDescription
idUUIDUnique event identifier
endpoint_idUUIDReceiving endpoint
organization_idUUIDOwning organization
event_typestringExtracted event type
payloadobjectFull JSON request body
headersobjectAll request headers
source_ipstringSender IP address
idempotency_keystringDeduplication key (derived from request or X-Idempotency-Key header)
statusstring"received" or "filtered"

DeliveryAttempt

{
"id": "uuid",
"event_id": "uuid",
"destination_id": "uuid",
"attempt_number": 1,
"status": "success",
"status_code": 200,
"response_body": "{\"ok\": true}",
"response_headers": {},
"error": null,
"latency_ms": 245,
"next_retry_at": null,
"payload_sent": {},
"created_at": "2025-03-14T10:00:00Z"
}
FieldTypeDescription
idUUIDUnique attempt identifier
event_idUUIDSource event
destination_idUUIDTarget destination
attempt_numberinteger1-based attempt counter
statusstring"queued", "success", "failed", "retrying", "canceled"
status_codeintegerHTTP response status code
response_bodystringFirst 4KB of response body
response_headersobjectResponse headers
errorstringError message
latency_msintegerRound-trip time in milliseconds
next_retry_attimestampScheduled retry time
payload_sentobjectActual payload delivered to the destination

FilterGroup

{
"id": "uuid",
"endpoint_id": "uuid",
"name": "Accept pushes to main",
"logic": "AND",
"is_enabled": true,
"conditions": []
}

FilterCondition

{
"id": "uuid",
"filter_id": "uuid",
"field": "body.ref",
"operator": "eq",
"value": "refs/heads/main",
"position": 0
}

APIKey

{
"id": "uuid",
"project_id": "uuid",
"name": "CI/CD Key",
"prefix": "dsp_abc",
"created_at": "2025-03-14T10:00:00Z",
"revoked_at": null
}
FieldTypeDescription
idUUIDUnique key identifier
project_idUUIDParent project
namestringDisplay name
prefixstringVisible key prefix (e.g., dsp_abc)
revoked_attimestampRevocation time (null if active)

OAuthConnection

{
"id": "uuid",
"project_id": "uuid",
"provider": "github",
"provider_user_id": "12345",
"provider_username": "octocat",
"scopes": "repo,admin:repo_hook",
"metadata": {},
"created_at": "2025-03-14T10:00:00Z",
"updated_at": "2025-03-14T10:00:00Z"
}
FieldTypeDescription
providerstring"github", "gitlab", "bitbucket", "slack", "jira", "linear", "stripe", or "discord"
provider_user_idstringUser ID on the provider
provider_usernamestringUsername on the provider
scopesstringGranted OAuth scopes
metadataobjectAdditional provider-specific data

Entity Relationships

Organization
├── OrganizationMember (roles: owner, admin, developer, viewer)
└── Project
├── WebhookEndpoint
│ ├── FilterGroup → FilterCondition
│ └── EndpointDestination (link) ──┐
├── Destination ◄──────────────────────┘
├── MessageTemplate
├── Transform
├── APIKey
├── OAuthConnection
└── Event → DeliveryAttempt