Gmail access & sync

The technical detail behind Selyf's Gmail integration: scope, sync, and live updates.

OAuth scope

Selyf requests the gmail.readonly scope only, via a standard Google OAuth Authorization Code flow. This scope does not permit sending, deleting, or modifying mail — Google enforces this at the API level, independent of anything this application chooses to do.

What gets synced

A sync fetches inbox message metadata (subject, sender, a short snippet, timestamps, unread status) in bounded, paginated batches. Message bodies and attachments are never fetched for storage.

Live updates

Selyf registers a Gmail watch that notifies it of inbox changes via a Google Cloud Pub/Sub pull subscription — Selyf polls that subscription, rather than exposing a public webhook Google (or anyone else) could call directly. A missed or expired notification falls back automatically to a full resync, so updates never silently stop.

Idempotent, resumable sync

Sync always resumes from Selyf’s own last-known Gmail history checkpoint, never from a notification’s own payload — so a duplicate or out-of-order notification is harmless, and re-running a sync never creates duplicate data.

Disconnecting

Disconnecting from the Security page revokes access with Google and cancels Selyf’s Gmail watch immediately, rather than letting it continue receiving notifications until its natural expiration.