IZGD plugs Gmail and Calendar into the matter file

A read-only Google Workspace connector that turns the inbox into a triage queue and lets you drop an email attachment straight onto a matter.

integrationworkflow

IZGD built a Google Workspace integration for the backend: connect a Google account, and Mike pulls in mail and calendar. The connection is read-only by design (it can see Gmail and Calendar, not change them), and the access tokens are encrypted before they're stored, so a database leak doesn't hand someone your inbox.

The practical payoff is mail triage. Incoming email lands in a list, and filing an attachment into the right matter is one click. Behind that sits a scorer that matches an email to a matter using plain rules rather than an AI guess, which makes the matching predictable and easy to audit. IZGD also reworked document handling so attachments and manual uploads run through the same path, meaning anything filed from email gets treated like a real document.

So what Worth a look for any firm drowning in client email that wants it landing in the matter file instead of a separate inbox.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

12 commits from IZGD/legal-platform, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
e04b1fc8 chore(backend): add googleapis dep and node test runner SW3xyz 2026-06-16 ↗ GitHub
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
a16685d7 feat(db): tables for Google connection and email triage SW3xyz 2026-06-16 ↗ GitHub
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b9e3b12d feat(backend): encrypted Google token store + OAuth client SW3xyz 2026-06-16 ↗ GitHub
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
8e8aba3c refactor(backend): address googleAuth review (key fallback, error log, env docs) SW3xyz 2026-06-16 ↗ GitHub
Adds API_KEYS_ENCRYPTION_SECRET fallback to match userApiKeys, logs decrypt failures, documents GOOGLE_* vars in .env.example, hardens tampered-tag test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b606eb3f feat(backend): deterministic email→matter scoring SW3xyz 2026-06-16 ↗ GitHub
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
634ad9cb refactor(backend): extract reusable ingestDocument() core SW3xyz 2026-06-16 ↗ GitHub
commit body
Moves the document ingestion pipeline (R2 upload, structure tree,
DOCX→PDF conversion, document_versions V1 row, status update) from
handleDocumentUpload into ingestDocument() in lib/ingest.ts so that
the upcoming mail-attachment-filing task can reuse it without touching
the HTTP layer. The countPdfPages and extractStructureTree helpers are
also moved (not duplicated). The upload routes remain behaviourally
identical: same HTTP status codes, same response shape, same audit
event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7f3a6062 refactor(backend): address ingest review (drop dead imports, cleaner error, .doc test) SW3xyz 2026-06-16 ↗ GitHub
Removes now-unused storageKey/convertedPdfKey imports from documents.ts, renders ingest errors without the Error: prefix, and covers .doc in allowedDocType test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
d542d7a0 feat(backend): Gmail and Calendar API wrappers SW3xyz 2026-06-16 ↗ GitHub
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
a11135fa feat(backend): Google OAuth connect/disconnect + calendar route SW3xyz 2026-06-16 ↗ GitHub
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
baa9e664 feat(backend): mail sync, triage list, one-click attachment filing SW3xyz 2026-06-16 ↗ GitHub
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5d11476b refactor(backend): address mail-routes review (ingest error handling, ignore audit) SW3xyz 2026-06-16 ↗ GitHub
Wraps ingestDocument in try/catch returning a structured 502, adds email.ignore audit event, documents the pilot-scale TOCTOU limitation on filing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9cb2f358 fix(backend): get Google email via Gmail getProfile (no userinfo scope) + log callback errors SW3xyz 2026-06-16 ↗ GitHub
commit body
oauth2.userinfo.get() needed the email/openid scope we don't request, so the OAuth callback threw and redirected to ?google=error. Use gmail.users.getProfile (works with gmail.readonly) and log the callback error path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-665.md from inside the repo you want the changes in.

⬇ Download capture-thread-665.md