Repository navigation
feat(sources): Google Calendar as a sensor, as a service account or a connected Google account - #399
Merged
Merged
Conversation
… connected Google account A new source type, gcal, reads Google Calendar through the Calendar API with read-only access: each calendar is a folder and each event a file <calendar id>/<event id>.ics, read as text exactly as an iCal feed's events are, so browsing, choosing events, watching and importing work unchanged. It signs in as a service account (its key file; acting as a Workspace user through domain-wide delegation with impersonate) or as a connected Google account (an OAuth client's authorized user JSON). google_auth.py is the shared sign-in layer for Google sources: JWT bearer and refresh-token access tokens, cached in memory, every call to Google a row in the activity ledger, and Google's own token endpoint whatever a key file says. Events carry cancelled occurrences (EXDATE) and their video call, which the event text now shows for iCal feeds too. The web app's connection dialog gains the Google Calendar form; docs, changelog and threat model describe it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
# Conflicts: # CHANGELOG.md
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: a Google calendar reached Lens only as an iCal feed (its secret address).
After: Sources has a Google Calendar connection (type
gcal, alsoPOST /api/v1/sources). Each calendar is a folder and each event a file<calendar id>/<event id>.ics, read as text exactly as an iCal feed's events are, so browsing, picking events, watching and importing work unchanged. It reads through the Calendar API with the read-onlycalendar.readonlyscope and signs in either:calendars), or, in Google Workspace, a user's calendars through domain-wide delegation (impersonate);client_id,client_secret,refresh_token). A "Connect with Google" button that fills this in from a consent screen is the next PR.Events also say which occurrences of a repeating event were cancelled (EXDATE) and their video call; the event text now shows both for iCal feeds too. Working-location entries are left out, and watching the whole account skips Google's own holiday/birthday calendars.
days_back(365) leaves out old events.How:
app/domain/google_auth.pyis the shared Google sign-in layer (JWT bearer for service accounts, refresh tokens for accounts, access tokens cached in memory, every call a row in the activity ledger, Google's own token endpoint whatever a key file'stoken_urisays).app/domain/gcal.pymaps the Calendar API to files;feeds.pydispatches to it through a smallOWNtable that other Google sources (Gmail) can join. The connection dialog gets the Google Calendar form.Motivation and Context
Adeel asked for Google Calendar as a sensor, both by OAuth and service account.
Types of changes
!in the title)Checklist:
tests/api/test_google_calendar_source.pyagainsttests/fake_google.py;__tests__/sources-model.test.ts).docs/accordingly (docs/processing.md,docs/sensors.md).## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
POST /api/v1/sourceswith typegcal, browse, watch and import through the same API as every source.google.token,google.calendar).make openapi).syncTokenincremental sync instead of a full list each poll; event attachments; push notifications (events.watch) instead of polling.🤖 Generated with Claude Code
https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
Generated by Claude Code