Google Drive Integration
Sync documents from Google Drive into Sophic so your existing files become part of the searchable knowledge base.
Connect
- Open Settings → Integrations → Google Drive in the dashboard.
- Click Connect Google Drive.
- Authorize Sophic on Google's consent screen.
Sophic requests read-only access (drive.readonly) plus your basic profile (userinfo.email, userinfo.profile). Connecting requires an admin or owner role.
Optionally, set a root folder after connecting to limit syncing to that folder and its descendants instead of the whole Drive.
What gets synced
Sophic imports text-bearing files and skips binaries and images:
- Google Docs (exported as Markdown)
- Google Sheets and Slides (exported as CSV / plain text)
- PDFs
- Plain text and Markdown files
The sync is one-way — Google-side edits import into Sophic, but Sophic doesn't write back to Drive.
Sync cadence
- Initial backfill runs when you connect.
- A scheduled sweep runs about every 15 minutes.
- A Sync now button triggers an immediate pull.
Syncs are workspace-locked so runs never overlap.
Configuration (operators)
Self-hosted deployments need these environment variables:
| Variable | Purpose |
|---|---|
GOOGLE_DRIVE_CLIENT_ID | OAuth client ID (Google Cloud Console) |
GOOGLE_DRIVE_CLIENT_SECRET | OAuth client secret |
GOOGLE_DRIVE_STATE_SECRET | HMAC secret for signing the OAuth state (openssl rand -hex 32) |
GOOGLE_DRIVE_CRON_SECRET | Bearer secret protecting POST /api/google-drive/sync-all |
NEXT_PUBLIC_APP_URL | App base URL, used to build the OAuth redirect |
Refresh tokens are encrypted at rest (pgsodium).