Google Workspace

@idaria/integration-google-workspacegoogleworkspace

Connects idaria to your company's Google Workspace: the assistant reads calendars, mail, files and the directory — and, if you allow it, creates events and sends mail. Runs on a technical service account your IT sets up once; no personal login involved.

integration · communication · productivity

Before you start

Set up by
IT admin
Takes about
20 minutes

Requires a Google Workspace account with admin access and a Google Cloud service account with domain-wide delegation.

Setup guide

Connect Google Workspace

This integration talks to the Google Workspace APIs (Calendar, Gmail, Drive/Docs/Sheets, Admin Directory, People) using a Google Cloud service account with domain-wide delegation — server-to-server, no interactive sign-in. Every request impersonates a Workspace user. About 15 minutes, and you need a Workspace super-admin to authorise the delegation.

1. Create a service account + key (Google Cloud Console)

  1. console.cloud.google.com → pick or create a project → APIs & Services → Enable APIs & Services and enable: Google Calendar API, Gmail API, Google Drive API, Google Docs API, Google Sheets API, Admin SDK API, People API (enable only the ones you'll use).
  2. IAM & Admin → Service Accounts → Create service account. Name it (e.g. "idaria") → Done.
  3. Open the service account → Keys → Add key → Create new key → JSON. A .json file downloads. From it you need two values: client_email → field Service-account email, and private_key (the long -----BEGIN PRIVATE KEY----- … block) → field Service-account private key.
  4. On the service account's Details page note the Unique ID (a long number) — that is the Client ID used in step 2.

2. Authorise domain-wide delegation (Workspace Admin console)

  1. admin.google.com → Security → Access and data control → API controls → Domain-wide delegation → Manage domain-wide delegation → Add new.
  2. Client ID = the service account's Unique ID (step 1.4).
  3. OAuth scopes = the comma-separated scope list. After install, the plugin logs the exact scopes it will request (delegated scopes (authorise these…)); paste those. The defaults are:
    https://www.googleapis.com/auth/calendar.readonly,
    https://www.googleapis.com/auth/gmail.readonly,
    https://www.googleapis.com/auth/drive.readonly,
    https://www.googleapis.com/auth/documents.readonly,
    https://www.googleapis.com/auth/spreadsheets.readonly,
    https://www.googleapis.com/auth/admin.directory.user.readonly,
    https://www.googleapis.com/auth/contacts.readonly,
    https://www.googleapis.com/auth/directory.readonly
    
    With Enable writes on, the requested set changes: add https://www.googleapis.com/auth/calendar.events, https://www.googleapis.com/auth/gmail.send, https://www.googleapis.com/auth/gmail.compose, and the FULL https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/documents and https://www.googleapis.com/auth/spreadsheets. The full Drive, Docs and Sheets scopes REPLACE their .readonly variants above (do not list both: domain-wide delegation matches scopes literally, so an un-authorised .readonly left in the request fails the whole token). The plugin logs the exact set at activation; authorise that verbatim.
  4. Authorise. Delegation can take a few minutes to propagate.

3. Fill in the fields below

FieldValue
Service-account emailclient_email from the JSON key
Service-account private keyprivate_key from the JSON key (paste the whole PEM block)
Default userThe Workspace user the integration acts as by default (e.g. an assistant mailbox)
Admin userA super-admin's email — used for directory lookups (optional; falls back to the default user)
SurfacesWhich areas to enable (optional; default all)
Enable writesOff = read-only; on = also calendar/gmail writes

Install — connectivity is verified in the background by minting a token for the default user (watch the plugin logs for connected or a token probe failed warning).

Troubleshooting

  • unauthorized_client / 401 at the token step — the Client ID or a scope is not authorised in step 2 (every scope the plugin requests must be listed verbatim), or delegation has not propagated yet.
  • 403 on a surface — that API is not enabled in the Cloud project (step 1.1), or the impersonated user lacks access.
  • invalid_grant — the Default user / Admin user email does not exist in the Workspace domain, or the private key is malformed (paste the entire PEM, including the BEGIN/END lines).
  • Directory returns 403 — directory reads impersonate the Admin user; it must be a real admin and admin.directory.user.readonly must be authorised.

Least privilege: enable only the surfaces you need and leave Enable writes off unless the assistant should create events or send mail.

Setup fields

The operator fills these in when installing the plugin.

  • gw_sa_key_filejson_file, optional
    Service-account key file (JSON)Upload the JSON key file downloaded from the Google Cloud Console (service account → keys → add key). The service-account email and private key below are filled from it automatically — no copying needed. The file itself is not stored.
  • gw_sa_client_emailstring, required
    Service-account emailThe service account's email (client_email in the JSON key), e.g. idaria@my-project.iam.gserviceaccount.com. This is NOT your own Google address — a service account is a technical identity you create in Google Cloud.
  • gw_sa_private_keysecret, required
    Service-account private keyThe private_key from the service-account JSON key — the full PEM block (-----BEGIN PRIVATE KEY----- … -----END PRIVATE KEY-----). This is NOT your Google account password. Stored encrypted in the vault and shown only once. Maps to GW_SA_PRIVATE_KEY.
  • gw_subject_defaultstring, required
    Default userWorkspace user the integration impersonates when a tool call omits an explicit user, e.g. an assistant mailbox. Must exist in your Workspace domain. This IS a normal person's address, unlike the service-account email above.
  • gw_admin_subjectstring, optional
    Admin userSuper-admin email used for Admin Directory lookups. Optional — falls back to the default user (which then also needs the admin.directory scope).
  • gw_surfacesstring, optional
    SurfacesComma-separated areas to enable: calendar, gmail, drive, directory, people. Omit for all. Tools and requested scopes are scoped to this list.
Show all 11 setup fields
  • gw_delegated_scopesstring, optional
    Delegated scopes (override)Advanced: comma/space-separated OAuth scope list to request instead of the surface-derived defaults. Must match what you authorise in the Admin console. Leave empty to use the defaults.
  • gw_token_urlstring, optional
    Token endpoint (override)Advanced: OAuth2 token endpoint. Defaults to https://oauth2.googleapis.com/token.
  • gw_max_bytesstring, optional
    Max response size (bytes)Caps a single API response to prevent memory blow-ups on large reads. Default 1048576 (1 MiB).
  • gw_cache_ttl_secondsstring, optional
    Read cache TTL (seconds)How long identical read queries are cached in-process. Writes always bypass + clear the cache. Default 60.
  • enable_writesboolean, optional
    Enable writesWhen ON, also registers the write tools: calendar (create/update event), gmail (send/draft mail), sheets (gw_sheet_write values, gw_sheet_add_tab, gw_sheet_duplicate_tab, and gw_sheet_batch_update for full formatting/formulas) and drive (gw_drive_create). Requires the matching write scopes to be authorised. Default OFF (read-only).

Permissions

This is everything the plugin is allowed to access once it is installed.

memory
readsnone
writesnone
graph
readsnone
writesnone
network
outboundoauth2.googleapis.comwww.googleapis.comgmail.googleapis.comdocs.googleapis.comsheets.googleapis.comadmin.googleapis.compeople.googleapis.com
filesystem
scratchno

Versions

VersionCoreSizePublishedsha256Download
v0.6.0latest>=1.78.0 <2.048.8 KB30 Nov 2026d243dbc3eb86….zip