Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

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

Feature ID: CE-21
Created: 2026-03-31
Status: ✅ Complete

Overview

CE-21 Calendar & Scheduling Integration uses three edge functions for OAuth, sync, and free/busy queries.

Edge Functions

FunctionPurposeTrigger
calendar-oauth-callbackOAuth code exchange, token encryption, connection creationUser-initiated OAuth redirect
calendar-syncTwo-way event sync (poll or webhook)Cron (configurable interval) or webhook
calendar-freebusyFree/busy availability queriesOn-demand from UI
calendar-scheduleCreate meeting on external calendarOn-demand from ScheduleMeetingDialog

Sync Configuration

Sync poll interval is configured per-organization via ce_module_settings.calendar_sync_poll_interval_minutes (default: 15 minutes, range: 5–60).

Cron Setup

To enable automatic sync polling, create a pg_cron job or Supabase Cron that invokes calendar-sync at the configured interval:
-- Example: every 15 minutes
SELECT cron.schedule(
  'calendar-sync-poll',
  '*/15 * * * *',
  $$SELECT net.http_post(
    url := current_setting('app.supabase_url') || '/functions/v1/calendar-sync',
    headers := jsonb_build_object(
      'Authorization', 'Bearer ' || current_setting('app.service_role_key'),
      'Content-Type', 'application/json'
    ),
    body := '{"mode":"poll"}'::jsonb
  )$$
);

Webhook Setup (Google/Microsoft)

For real-time sync via push notifications:
  1. Google Calendar: Configure a watch channel pointing to {SUPABASE_URL}/functions/v1/calendar-sync
  2. Microsoft Graph: Register a subscription for calendar change notifications

Monitoring

  • Edge function logs: Supabase Dashboard → Edge Functions → Logs
  • Sync failures: Check ce_calendar_events.sync_status = 'error'
  • Connection health: Check ce_calendar_connections.last_sync_at for stale connections

Troubleshooting

SymptomCheck
Events not syncingsync_enabled on connection; last_sync_at timestamp; edge function logs
OAuth failureToken expiry; refresh token validity; provider API quotas
Free/busy timeoutCalendar API rate limits; connection token validity