VOYAGE
Voyage / TECHNICAL / Integrations

Integrations

The edge gateway routes /v1/webhooks to the integrations worker and routes /v1/google-sync to the Google sync worker binding (workers/edge-gateway/src/router.ts:54-89).

Integrations

Current Shape

The edge gateway routes /v1/webhooks to the integrations worker and routes /v1/google-sync to the Google sync worker binding (workers/edge-gateway/src/router.ts:54-89).

The gateway configuration binds integrations, Google sync, and other domain Workers as Cloudflare service bindings rather than using network calls between Workers (workers/edge-gateway/wrangler.toml:17-59).

Outbound Webhooks

Webhook creation and dispatch inputs are schema validated before endpoint records or deliveries are created (workers/integrations/src/routes/webhooks.ts:7-17).

Webhook signatures are HMAC SHA-256 signatures over the outgoing payload when a secret is configured (workers/integrations/src/routes/webhooks.ts:22-35).

Delivery sends JSON POST requests with X-Webhook-Event, X-Webhook-Delivery, and optional X-Webhook-Signature-256 headers, uses a ten-second timeout, and treats 2xx responses as success (workers/integrations/src/routes/webhooks.ts:48-120).

Internal dispatch selects active endpoints for the company, filters by endpoint event subscription, delivers each payload, and records delivery status, response, signature, and next retry state (workers/integrations/src/routes/webhooks.ts:258-330).

Retry policy allows three attempts with delay tiers of thirty seconds, five minutes, and thirty minutes (workers/integrations/src/routes/webhooks.ts:19-20).

Google Calendar Sync

Google sync processes active or errored Google calendar connections and handles each connection independently (workers/integrations/src/services/sync-engine.ts:25-36).

The sync engine parses connection configuration and skips records missing staff ID, calendar ID, staff email, tenant ID, or credentials (workers/integrations/src/services/sync-engine.ts:43-60).

Google credentials are loaded from tenant config and passed into a Google service account client before event sync runs (workers/integrations/src/services/sync-engine.ts:63-74).

Google delta sync writes busy events into availability overrides, removes cancelled overrides, skips outbound platform events by private extended property, skips transparent/free events, and updates sync status/token data (workers/integrations/src/services/sync-engine.ts:81-149).

Google watch channels are created or renewed when the connection is pending or needs renewal, and sync errors set connection status to error with token reset on 410 responses (workers/integrations/src/services/sync-engine.ts:153-175).

Exchange Outbound Sync

Exchange outbound sync loads an active staff connection, reads provider credentials, creates local calendar mappings, logs sync errors, and updates connection sync timestamps (workers/exchange-sync/src/outbound.ts:24-134).

Outbound processing creates or updates Microsoft Graph events for created and updated sessions after loading credentials and connection state (workers/exchange-sync/src/outbound.ts:137-239).

The Exchange sync worker exposes an internal outbound route that validates session payloads before calling outbound processing (workers/exchange-sync/src/index.ts:12-64).

The Exchange sync worker also processes queue messages and scheduled tasks; every five minutes it commits pending cancellations, and on other scheduled runs it renews subscriptions (workers/exchange-sync/src/index.ts:84-116).

Exchange Inbound Reconciliation

Inbound sync converts Graph events into snapshots, loads active pending changes, stores availability overrides, and de-loops outbound-originated Graph events through transaction/session mapping (workers/exchange-sync/src/inbound.ts:45-55, workers/exchange-sync/src/inbound.ts:215-245, workers/exchange-sync/src/inbound.ts:300-407).

The reconciliation plan turns deleted events into pending cancellation, restored events into restore commands, time changes into reschedule commands, and declined events into decline actions (packages/calendar-sync-core/src/reconciliation.ts:21-81).

Calendar command wrappers call the booking command engine for pending cancellation, restore, cancel, and reschedule, then filter inbound notification side effects where needed (packages/calendar-sync-core/src/commands.ts:13-39).

Inbound Exchange sync checks reschedule conflicts, can reject a Graph move by restoring the event to the booking time, can flag a declined invite, builds a reconciliation plan, and applies pending cancellation, restore, reschedule, and decline actions (workers/exchange-sync/src/inbound.ts:431-648).

Graph webhook handling accepts Microsoft validation tokens and enqueues inbound messages for asynchronous processing (workers/exchange-sync/src/inbound.ts:651-690).

Inbound queue processing loads the connection, credentials, delta events, mapping data, and updated delta token for each subscribed calendar (workers/exchange-sync/src/inbound.ts:694-745).

Corrections From Frozen HTML

The frozen page's high-level bidirectional calendar-sync framing remains valid, but current docs must include Exchange pending-cancellation reconciliation and de-looping details because those paths now exist in shared calendar-sync core and the Exchange worker (packages/calendar-sync-core/src/reconciliation.ts:21-81, workers/exchange-sync/src/inbound.ts:300-407).


last verified: 2026-04-24, commit 14f3b190db8817399dcd30e1dc4e1ae7674bbf8a