--- doc-schema-version: 1 summary: "CLI reference for `openclaw webhooks` (Gmail Pub/Sub setup and runner)" read_when: - You want to wire Gmail Pub/Sub events into OpenClaw - You need the full flag list and default values title: "Webhooks" --- # `openclaw webhooks` `openclaw webhooks` sets up and runs the Gmail Pub/Sub transport through `gog` (gogcli). It does not register [internal `HOOK.md` hooks](/automation/hooks), manage arbitrary [Gateway hook mappings](/automation/cron-jobs#webhooks), or manage the [TaskFlow Webhooks plugin](/plugins/webhooks). ## Subcommands ```bash openclaw webhooks gmail setup --account [...] openclaw webhooks gmail run [--account ] [...] ``` | Subcommand | Description | | ------------- | ------------------------------------------------------------------------------------- | | `gmail setup` | One-time wizard: Gmail watch, Pub/Sub topic/subscription, and OpenClaw hook delivery. | | `gmail run` | Run `gog gmail watch serve` plus the watch auto-renew loop in the foreground. | The Gateway also auto-starts `gog gmail watch serve` on boot once `hooks.enabled=true` and `hooks.gmail.account` is set (set by `gmail setup`). `gmail run` provides a foreground watcher for debugging or when the Gateway watcher is disabled. Do not run both against the same listener. See [Gmail Pub/Sub integration](/automation/cron-jobs#gmail-pubsub-integration) for the auto-start details and `OPENCLAW_SKIP_GMAIL_WATCHER` opt-out. ## `webhooks gmail setup` ```bash openclaw webhooks gmail setup --account you@example.com openclaw webhooks gmail setup --account you@example.com --project my-gcp-project --json openclaw webhooks gmail setup --account you@example.com --hook-url https://gateway.example.com/hooks/gmail ``` Authenticates `gcloud`, enables the required APIs, creates or updates the Pub/Sub topic/subscription and push endpoint, starts the Gmail watch, and writes `hooks.gmail` with `hooks.enabled: true` and the Gmail preset. Missing `gcloud`, `gog`, and Tailscale dependencies can be installed automatically on macOS with Homebrew; other platforms need them installed first. The Gmail account must already be authorized in `gog`. Setup changes cloud resources, exposure settings, and local config; it is not a read-only check. Re-running it can apply the CLI defaults over saved Gmail settings. It prints `Next: openclaw webhooks gmail run`; use that only if the Gateway-managed watcher is not already running. This command connects Gmail transport but does not create a restricted reader agent or the session-key policy required by the templated preset. Without a custom Gmail mapping that sets `agentId`, inbound email runs as the default agent with that agent's effective workspace, sandbox, and tool policy. Complete [Configure a restricted Gmail reader](/automation/cron-jobs#configure-a-restricted-gmail-reader-recommended) before running setup for an untrusted inbox. ### Required | Flag | Description | | ------------------- | ----------------------- | | `--account ` | Gmail account to watch. | ### Pub/Sub options | Flag | Default | Description | | ----------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--project ` | (none) | GCP project id (the OAuth client owner). Falls back to the topic's own project id, then to the project resolved from `gog` credentials. | | `--topic ` | `gog-gmail-watch` | Pub/Sub topic name. | | `--subscription ` | `gog-gmail-watch-push` | Pub/Sub subscription name. | | `--label