-
-
Notifications
You must be signed in to change notification settings - Fork 72
FEAT: native Gmail REST API backend (alongside imap/jmap/pop3) #1197
Copy link
Copy link
Open
Labels
area/cliCLI flags / commandsCLI flags / commandsarea/configConfiguration / settingsConfiguration / settingsarea/docsDocs site / READMEDocs site / READMEarea/fetcherIMAP fetch / IDLE / searchIMAP fetch / IDLE / searcharea/oauthOAuth / XOAUTH2 / auth flowsOAuth / XOAUTH2 / auth flowsarea/pgpPGP / encryptionPGP / encryptionarea/tuiTerminal UI / view layerTerminal UI / view layerchoreMaintenance, refactor, cleanupMaintenance, refactor, cleanupdocumentationDocumentation changesDocumentation changesenhancementNew feature or requestNew feature or requestquestionFurther information requestedFurther information requested
Metadata
Metadata
Assignees
Labels
area/cliCLI flags / commandsCLI flags / commandsarea/configConfiguration / settingsConfiguration / settingsarea/docsDocs site / READMEDocs site / READMEarea/fetcherIMAP fetch / IDLE / searchIMAP fetch / IDLE / searcharea/oauthOAuth / XOAUTH2 / auth flowsOAuth / XOAUTH2 / auth flowsarea/pgpPGP / encryptionPGP / encryptionarea/tuiTerminal UI / view layerTerminal UI / view layerchoreMaintenance, refactor, cleanupMaintenance, refactor, cleanupdocumentationDocumentation changesDocumentation changesenhancementNew feature or requestNew feature or requestquestionFurther information requestedFurther information requested
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Backlog
Is your feature request related to a problem?
The Gmail OAuth path that landed in #415 is great, but it's still IMAP+XOAUTH2 underneath. That means matcha keeps using IMAP's folder/mailbox model when Gmail is fundamentally label-based, depends on the user keeping IMAP enabled (which Workspace admins can disable), and uses IMAP IDLE for push instead of Gmail's native signals. A few open issues read like symptoms of forcing Gmail's data model through IMAP: #1137 (labels), #509 / #638 / #1130 (threading), #1166 (connection pool), #1169 (UIDVALIDITY).
Describe the solution you'd like
A new
backend/gmail/Provider that talks to Gmail's REST API (google.golang.org/api/gmail/v1) and registers asProtocol: gmailalongside the existingimap,jmap,pop3. The shape mirrorsbackend/jmap/jmap.goexactly: sameinit()registration, same string-ID-to-uint32 hashing pattern. Reuses the existing OAuth scaffolding inconfig/oauth.goandoauth_script.py; the Python helper picks up an--api-modeflag that adds thegmail.modifyscope forgmail-protocol accounts and leaves IMAP+OAuth accounts onmail.google.comunchanged.Send goes through
users.messages.sendwith raw RFC 822, so PGP-signed/encrypted mail flows through the existing composition pipeline byte-for-byte. Watch starts as History API polling; Pub/Sub is a follow-up.This is additive. The IMAP backend is unchanged. Users who keep
Protocol: imapsee no difference. The split exists because Workspace policies, IMAP-disabled accounts, and the data-model gap are real for some users but not all.Describe alternatives you've considered
Additional context
Pre-flight question before writing code: would this be welcome as a new backend, or would you rather see this energy go into the existing OAuth-IMAP path (#635 / #782)?
If welcome, I have a phased delivery in mind:
Affected packages: new
backend/gmail/; small additive changes totui/login.go,config/oauth_script.py,config/config.go; newdocs/docs/setup-guides/gmail-native.md. No changes tobackend/imap/,backend/jmap/,backend/pop3/, PGP, or the composition pipeline.Happy to skip this if it conflicts with where you want the OAuth area to go.