Connect a calendar
A user connects their work calendar from the Integrations page. They sign in and allow access on the calendar provider's consent page within 10 minutes, choose which calendars to sync, and the app imports their events. The journey also shows where they land when they deny access, come back too late, or the provider or the sync fails; disconnecting is a journey of its own.
What UJN shows here Point at a note to see its part of the drawing
The source (40 lines)
connect-calendar.puml
@startujnrender { direction: down; arrow_spacing: 24 }journey CALENDAR "Connect a calendar"description: "Connect a calendar from settings through the provider's consent page"unique_id_friendly: calendar start from_settings { description: "From settings" }view integrations { title: "Integrations"; description: "Calendar not connected"; route: /settings/integrations }handoff consent { title: "Provider consent page"; description: "Sign in and allow access"; channel: provider site; timeout: 10 min; resume: /oauth/calendar/callback }action exchange { title: "Exchange code for tokens" }system oauth { type: external; title: "Provider sign-in"; host: oauth.calendar.example }data connections { title: "Calendar connections"; description: "Tokens, encrypted"; location: table calendar_connections }view choose { type: modal; title: "Choose calendars"; description: "Which calendars to sync" }action first_sync { title: "Initial sync"; description: "Imports the next 90 days" }system calendar_api { type: external; title: "Provider calendar API"; host: api.calendar.example }view connected { title: "Calendar connected"; description: "Synced calendars and last sync"; route: /settings/integrations/calendar }view sync_failed { type: toast; title: "Sync failed"; description: "We'll try again in 15 minutes" }end done { type: success; description: "Calendar syncing" }ref disconnect { journey: CALENDAR_DISCONNECT; title: "Disconnect calendar"; description: "Revoke and delete the tokens" }end not_connected { type: failure; description: "Calendar not connected" } from_settings --> integrationsintegrations --> consent : [Connect calendar]consent ..> exchange : [Allow] validconsent ..> not_connected : [Allow] expiredconsent .x.> integrations : [Deny]exchange -left-> oauth { payload: [auth_code] }oauth ..> exchange { payload: [access_token, refresh_token] }exchange -right-> connections { payload: [access_token, refresh_token] }exchange --> choose : token receivedexchange -x-> not_connected : provider errorchoose --> first_sync : [Start sync] { payload: [calendar_ids] }first_sync -left-> calendar_api { payload: [access_token, calendar_ids] }calendar_api ..> first_sync { payload: [events] }first_sync --> connected : syncedfirst_sync -x-> sync_failed : failedsync_failed .down.> connectedconnected -left-> done : [Done]connected -right-> disconnect : [Disconnect]@endujn