This document defines the external integration and webhook architecture for CommDesk.
Purpose:
- allow communities and partners to integrate CommDesk with external systems
- deliver reliable lifecycle events to third-party endpoints
- keep integration behavior secure, auditable, and replayable
- prevent data drift between CommDesk and connected tools
This system supports both pull and push integrations:
- pull: API access using scoped API keys
- push: webhook subscriptions and event delivery
Related docs:
- CommDesk Overall System Master Guide
- CommDesk Event System
- CommDesk RSVP System
- CommDesk Check-In and Badge System
- CommDesk Participant Platform System
- CommDesk Judging System
- CommDesk Sponsor and Partner System
- CommDesk Community Trust, Review, and AI Scoring System
- CommDesk Frontend Boundary System (Desktop + Website)
Integration system must:
- expose stable API contracts for external systems
- emit lifecycle events through webhooks with delivery guarantees
- provide idempotency and replay safety
- support fine-grained API key permissions
- isolate integrations by
communityId - provide complete audit logs for all integration actions
External systems call CommDesk APIs using scoped API keys.
Examples:
- community website reading published events
- partner CRM syncing sponsor applications
- internal BI tool pulling RSVP analytics
CommDesk pushes event payloads to subscriber endpoints.
Examples:
- send
rsvp_submittedto Discord bot backend - send
leaderboard_publishedto marketing automation - send
certificate_issuedto credential verifier
Best practice:
- webhook for trigger
- API pull for full object detail
This reduces payload size while preserving data freshness.
Domain Action (Event/RSVP/Judging/etc.)
-> Domain Event Recorded
-> Outbox Entry Created (same transaction)
-> Webhook Dispatcher picks pending entries
-> Signs + delivers payload
-> Success: mark delivered
-> Failure: retry with backoff
-> Max attempts reached: Dead Letter Queue
Core components:
IntegrationSubscriptionServiceOutboxEventStoreWebhookDispatcherDeliveryAttemptLoggerDeadLetterQueueReplayService
Use lowercase snake_case event names.
Pattern:
<domain>_<action>
Examples:
community_signup_requestedcommunity_approvedmember_createdevent_publishedrsvp_submittedrsvp_promoted_from_waitlistsubmission_finalizedscore_submittedround_finalizedleaderboard_publishedcontract_signedpayment_releasedcertificate_issuedcommunity_trust_score_updated
Every event type must include version:
eventType: rsvp_submitted
eventVersion: 1
Breaking payload changes require incrementing eventVersion.
Every webhook must use one envelope format.
{
"id": "wh_evt_01JXYZ...",
"eventType": "rsvp_submitted",
"eventVersion": 1,
"occurredAt": "2026-03-18T10:22:40.000Z",
"communityId": "cmty_123",
"resource": {
"type": "registration",
"id": "reg_456"
},
"actor": {
"type": "user",
"id": "usr_789"
},
"data": {},
"meta": {
"traceId": "trc_abc",
"deliveryAttempt": 1,
"source": "commdesk-api"
}
}Envelope rules:
idglobally uniqueoccurredAtimmutablecommunityIdalways present for scoped domainsdataschema depends oneventType+eventVersion
subscriptionId
communityId
endpointUrl
secretHash
status (Active | Paused | Disabled)
subscribedEvents[]
filterRules
createdBy
createdAt
updatedAt
Rules:
- community-level subscribers receive only their
communityIdevents - platform-level integrations require elevated permissions
- sensitive event families require explicit allowlist
At subscription creation:
- send verification challenge request
- require successful response before activation
Use HMAC SHA-256 signatures.
Headers:
X-CommDesk-Webhook-Id
X-CommDesk-Event-Type
X-CommDesk-Event-Version
X-CommDesk-Timestamp
X-CommDesk-Signature
Signature base:
timestamp + "." + rawRequestBody
Receiver validates:
- HMAC match
- timestamp tolerance window (for replay protection)
Receiver should reject duplicate X-CommDesk-Webhook-Id values.
CommDesk should include short timestamp window validation guidance (for example, +/- 5 minutes).
API keys must be:
- generated once and shown once
- stored as hash only
- scoped by permissions
- revocable and rotatable
Webhook delivery is at-least-once.
Consumers must implement idempotency.
Treat HTTP 2xx as delivered.
Any non-2xx or timeout triggers retry.
Recommended exponential backoff:
attempt1: immediate
attempt2: +30s
attempt3: +2m
attempt4: +10m
attempt5: +30m
attempt6: +2h
attempt7: +8h
attempt8: +24h (final)
After final failure:
- move event to Dead Letter Queue
- notify integration owner/admin
Recommended defaults:
- connect timeout: 5s
- response timeout: 10s
- payload size cap: 256KB
Large data should be fetched via API using resource ID.
Strict global ordering is not guaranteed.
Best-effort ordering per (subscriptionId, resource.id) is recommended.
Receiver must de-duplicate by webhook envelope id.
CommDesk should provide idempotency key for sensitive write APIs:
Idempotency-Key: <uuid>
Webhook payload may arrive before all read models are fully materialized.
Consumer best practice:
- process trigger
- optionally fetch canonical data from API
When max retries fail, store:
webhookId
subscriptionId
eventType
payloadSnapshot
lastError
attemptCount
failedAt
POST /api/v1/integrations/webhooks/dlq/:webhookId/replay
POST /api/v1/integrations/webhooks/replay
Replay must keep original id for traceability and include replay metadata.
community_signup_requestedcommunity_approvedcommunity_rejectedmember_createdmember_activated
event_createdevent_publishedevent_archivedrsvp_submittedrsvp_approvedrsvp_rejectedrsvp_waitlistedrsvp_promoted_from_waitlistrsvp_checked_incheck_in_window_openedcheck_in_successfulcheck_in_revoked
badge_generatedbadge_printedbadge_issuedbadge_reprintedbadge_revoked
team_createdteam_join_request_submittedsubmission_finalizedscore_submittedround_finalizedleaderboard_publishedwinner_announced
sponsor_application_submittedrequest_negotiation_starteddeal_acceptedcontract_signedpayment_released
event_review_submittedcommunity_trust_score_updatedcertificate_issued
POST /api/v1/integrations/webhooks/subscriptions
GET /api/v1/integrations/webhooks/subscriptions
GET /api/v1/integrations/webhooks/subscriptions/:subscriptionId
PATCH /api/v1/integrations/webhooks/subscriptions/:subscriptionId
DELETE /api/v1/integrations/webhooks/subscriptions/:subscriptionId
POST /api/v1/integrations/webhooks/subscriptions/:subscriptionId/pause
POST /api/v1/integrations/webhooks/subscriptions/:subscriptionId/resume
GET /api/v1/integrations/webhooks/deliveries
GET /api/v1/integrations/webhooks/deliveries/:deliveryId
GET /api/v1/integrations/webhooks/dlq
POST /api/v1/integrations/webhooks/subscriptions/:subscriptionId/rotate-secret
POST /api/v1/integrations/webhooks/subscriptions/:subscriptionId/test
Standard integration error codes:
INTEGRATION_UNAUTHORIZEDWEBHOOK_SIGNATURE_INVALIDWEBHOOK_TIMESTAMP_EXPIREDWEBHOOK_ENDPOINT_UNREACHABLEWEBHOOK_RETRY_EXHAUSTEDWEBHOOK_SUBSCRIPTION_DISABLEDEVENT_VERSION_UNSUPPORTEDIDEMPOTENCY_KEY_REUSEDRATE_LIMIT_EXCEEDED
Track per subscription and global metrics:
- delivery success rate
- p50/p95 delivery latency
- retry rate
- DLQ volume
- replay success rate
- signature validation failure rate
Suggested SLO baseline:
- 99% of webhook deliveries succeed within 5 minutes (including retries)
Operational dashboards should include:
- top failing endpoints
- top failing event types
- sustained retry storms
Aligned with frontend boundary rules.
Desktop should own integration operations UI:
- create and manage webhook subscriptions
- pause/resume/revoke endpoints
- rotate secrets
- view failures and replay DLQ events
Website may expose read-only integration status badges for transparency use-cases but should not own integration administration.
Do not create two integration admin panels across desktop and website.
Recommended collections:
IntegrationSubscriptionIntegrationApiKeyOutboxEventWebhookDeliveryAttemptWebhookDeadLetterWebhookReplayAuditIntegrationAuditLog
Indexes to prioritize:
(communityId, status)on subscriptions(status, nextAttemptAt)on outbox deliveries(subscriptionId, createdAt)on delivery attempts- unique
(idempotencyKey, route, communityId)for protected writes
Required controls:
- audit every subscription change and secret rotation
- redact secrets and sensitive payload fields in logs
- enforce per-community rate limits
- allow emergency kill switch for abusive endpoints
Retention guidance:
- delivery attempts: 30-90 days
- DLQ records: 90-180 days
- audit logs: per compliance policy
Must-have tests:
- signature generation and validation tests
- retry and backoff schedule tests
- timeout and non-2xx handling tests
- idempotency behavior tests
- DLQ and replay workflow tests
- event version compatibility tests
Chaos testing recommendations:
- endpoint flapping (intermittent failure)
- high-latency targets
- burst event volumes
Phase 1:
- subscription management
- signed webhook delivery
- retry + DLQ baseline
Phase 2:
- replay operations
- delivery observability dashboards
- secret rotation UX
Phase 3:
- advanced filters and per-event payload templates
- provider adapters and integration catalog
Phase 4:
- event schema registry and self-serve integration testing sandbox
One-line definition:
CommDesk Integration and Webhook System is the secure event bridge that keeps external tools in sync with community lifecycle actions through signed, reliable, and replayable delivery.