Google Workspace Connector
Ingest Gmail, Drive, and Calendar activity into CortexDB.
Tails Gmail messages, Drive documents and comments, and Calendar events, and writes them to CortexDB as experiences.
Two ways to run this connector
Self-hosted — pip install 'cortexdb-connectors[google-workspace]' then cortexdb-sync sync google-workspace. Managed — CortexDB runs the connector as a worker. See the
Connectors overview.
1. Prepare credentials
Create a service account in Google Cloud, enable domain-wide delegation, and grant it the Gmail / Drive / Calendar read scopes in the Workspace admin console. Download the service-account key JSON, and choose a user to impersonate (delegated access).
What gets written
Gmail threads, Drive docs + comments, and Calendar events each become a POST /v1/experience on the
resolved scope (default org:<org>/source:google-workspace), with entity references and metadata
(source_url, thread / document / event ids).
Corrected fields
- The
idempotency_keyis version-aware per source — keyed on Gmailhistory_id, Drivemodified_time, or Calendarupdated. - Drive comments link to their document via a
thread=…label, notcontext.preceded_by.
Run it yourself
pip install 'cortexdb-connectors[google-workspace]'
pip install cortexdb-cli && cortexdb init
export GW_SERVICE_ACCOUNT_KEY=/path/to/service-account.json # required
export GW_DELEGATED_USER=[email protected] # required (impersonated user)
cortexdb-sync --api-url http://localhost:3141 sync google-workspace
cortexdb-sync --api-url http://localhost:3141 watch google-workspace --interval 300GW_SERVICE_ACCOUNT_KEY may be a path to the JSON key file (or its contents). Cursor state persists in
~/.cortexdb/sync_state.json.