Skip to main content

Google Drive Integration

Sync documents from Google Drive into Sophic so your existing files become part of the searchable knowledge base.


Connect

  1. Open Settings → Integrations → Google Drive in the dashboard.
  2. Click Connect Google Drive.
  3. 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:

VariablePurpose
GOOGLE_DRIVE_CLIENT_IDOAuth client ID (Google Cloud Console)
GOOGLE_DRIVE_CLIENT_SECRETOAuth client secret
GOOGLE_DRIVE_STATE_SECRETHMAC secret for signing the OAuth state (openssl rand -hex 32)
GOOGLE_DRIVE_CRON_SECRETBearer secret protecting POST /api/google-drive/sync-all
NEXT_PUBLIC_APP_URLApp base URL, used to build the OAuth redirect

Refresh tokens are encrypted at rest (pgsodium).


Next steps