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.

14 screens and steps18 arrows0 warnings

What UJN shows here Point at a note to see its part of the drawing

Connect a calendar  CALENDARConnect a calendar from settings through the provider's consent pageStart From settingsStartFrom settingsIntegrations (View) Calendar not connected Route: /settings/integrationsViewIntegrationsCalendar not connected/settings/integrationsProvider consent page (Handoff, returns) Sign in and allow access Channel: provider site Timeout: 10 min Resume: /oauth/calendar/callbackHandoff, returnsProvider consent pageSign in and allow accessprovider site · 10 minExchange code for tokens (Action)ActionExchange code for tokensProvider sign-in (System, external) Host: oauth.calendar.exampleSystem, externalProvider sign-inoauth.calendar.exampleCalendar connections (Server database) Tokens, encrypted Location: table calendar_connectionsServer databaseCalendar connectionsTokens, encryptedtable calendar_connectionsChoose calendars (Modal) Which calendars to syncModalChoose calendarsWhich calendars to syncInitial sync (Action) Imports the next 90 daysActionInitial syncImports the next 90 daysProvider calendar API (System, external) Host: api.calendar.exampleSystem, externalProvider calendar APIapi.calendar.exampleCalendar connected (View) Synced calendars and last sync Route: /settings/integrations/calendarViewCalendar connectedSynced calendars and last sync/settings/integrations/calendarSync failed (Toast) We'll try again in 15 minutesToastSync failedWe'll try again in 15 minutesEnd, success Calendar syncingEnd, successCalendar syncingDisconnect calendar (Journey) Revoke and delete the tokens Journey: CALENDAR_DISCONNECTJourneyDisconnect calendarRevoke and delete the tokensCALENDAR_DISCONNECTEnd, failure Calendar not connectedEnd, failureCalendar not connectedNo label Navigation from from_settings to IntegrationsConnect calendar Navigation from Integrations to Provider consent pageConnect calendarAllow · valid Return, resume from Provider consent page to Exchange code for tokensAllow · validAllow · expired Return, resume from Provider consent page to not_connectedAllow · expiredtoken received Navigation from Exchange code for tokens to Choose calendarstoken receivedprovider error Negative from Exchange code for tokens to not_connectedprovider errorStart sync Navigation from Choose calendars to Initial sync Payload: {calendar_ids}Start sync{calendar_ids}synced Navigation from Initial sync to Calendar connectedsyncedfailed Negative from Initial sync to Sync failedfailedNo label Return from Sync failed to Calendar connectedNo label Navigation, call from Exchange code for tokens to Provider sign-in Payload: {auth_code}{auth_code}No label Navigation, write from Exchange code for tokens to Calendar connections Payload: {access_token, refresh_token}{access_token, refresh_token}No label Navigation, call from Initial sync to Provider calendar API Payload: {access_token, calendar_ids}{access_token, calendar_ids}Done Navigation from Calendar connected to doneDoneDisconnect Navigation from Calendar connected to Disconnect calendarDisconnectDeny Failed return, resume from Provider consent page to IntegrationsDenyNo label Return, reply from Provider sign-in to Exchange code for tokens Payload: {access_token, refresh_token}{access_token, refresh_token}No label Return, reply from Provider calendar API to Initial sync Payload: {events}{events}
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