# google-workspace integration

Google Workspace helper CLI for Gmail and Google Calendar.

## What this integration is for

- Show mailbox identity/profile
- Send email
- Search mail
- Search calendar events
- Create calendar events

## Runtime

- `node`
- dependency: `googleapis`

Install inside the integration folder if needed:

```bash
cd integrations/google-workspace
npm install
```

## Auth and defaults

Default impersonation:
- `stefano@fiorinis.com`

Key lookup order:
1. `GW_KEY_PATH`
2. `~/.openclaw/workspace/.clawdbot/credentials/google-workspace/service-account.json`
3. `~/.clawdbot/credentials/google-workspace/service-account.json`

Optional env:
- `GW_IMPERSONATE`
- `GW_KEY_PATH`

## Commands

```bash
node integrations/google-workspace/gw.js whoami
node integrations/google-workspace/gw.js send --to "user@example.com" --subject "Hello" --body "Hi there"
node integrations/google-workspace/gw.js send --to "user@example.com" --subject "Report" --body "Attached is the PDF." --attach /tmp/report.pdf
node integrations/google-workspace/gw.js search-mail --query "from:someone@example.com newer_than:7d" --max 10
node integrations/google-workspace/gw.js search-calendar --timeMin 2026-03-17T00:00:00-05:00 --timeMax 2026-03-18T00:00:00-05:00 --max 20
node integrations/google-workspace/gw.js create-event --summary "Meeting" --start 2026-03-20T09:00:00-05:00 --end 2026-03-20T10:00:00-05:00
```

## Attachments

- `send` now supports one or more `--attach /path/to/file` arguments.
- Attachment content type is inferred from the filename extension; PDF attachments are sent as `application/pdf`.
- The default impersonation remains `stefano@fiorinis.com`, so this is the correct helper for actions explicitly performed on Stefano's behalf.
