openclaw webhooks
openclaw webhooks sets up and runs the Gmail Pub/Sub transport through gog (gogcli). It does not register internal HOOK.md hooks, manage arbitrary Gateway hook mappings, or manage the TaskFlow Webhooks plugin.
Subcommands
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 for the auto-start details and OPENCLAW_SKIP_GMAIL_WATCHER opt-out.webhooks gmail setup
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.
Required
Pub/Sub options
OpenClaw delivery options
gog gmail watch serve options
Tailscale exposure
Output
Command failures show bounded tails from both stdout and stderr, with terminal colors and progress redraws removed. Exit codes and recorded termination reasons distinguish timeouts, signals, and output limits; exit code
124 alone does not mean a timeout. An omission marker (…) indicates truncated output. These diagnostics can still contain sensitive command output: redact them before sharing.
--port, --max-bytes, and --renew-minutes require positive integers, without unit suffixes. --include-body has no negative CLI flag: set hooks.gmail.includeBody: false and let run inherit it.
webhooks gmail run
gog gmail watch serve plus periodic watch renewal in the foreground. Unexpected serve-process exits continue to restart after 5 seconds. A bind conflict stops restarts; run only one watcher per listener and stop the other watcher before retrying. Ctrl-C or SIGTERM cancels pending restarts and renewal work and shuts down the serve process tree. Investigate repeated exits in the logs.
run accepts the same Pub/Sub, OpenClaw delivery, gog gmail watch serve, and Tailscale flags as setup, except:
--accountis optional onrun; it falls back tohooks.gmail.account.rundoes not accept--project,--push-endpoint, or--json.- Unspecified flags inherit the matching
hooks.gmail.*setting;--hook-tokeninheritshooks.token. - Account, full topic path, hook token, and push token must be supplied or configured.
rundoes not generate missing tokens, provision Pub/Sub resources, or rewrite config. - Other fields use the setup defaults when no saved setting exists, except
--tailscale, which defaults tooffrather thanfunnel.
For
run, the --topic value is the full Pub/Sub topic path (projects/.../topics/...), not just the short topic name.Verify forwarding
SPAM, TRASH, DRAFT, and SENT messages. Check watcher forwarding errors,
then the Gateway hook completion/error logs and the reader’s run output.
A successful push or HTTP admission response does not prove email processing or
channel delivery completed. Follow the reader boundary
check before connecting an
untrusted inbox.