Skip to main content

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

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 before running setup for an untrusted inbox.

Required

Pub/Sub options

OpenClaw delivery options

gog gmail watch serve options

Tailscale exposure

Output

Setup output is sensitive: --json includes hookToken and pushToken, and the push endpoint printed in either format can contain its token. Redact output before sharing it.
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

Starts the Gmail watch and runs 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:
  • --account is optional on run; it falls back to hooks.gmail.account.
  • run does not accept --project, --push-endpoint, or --json.
  • Unspecified flags inherit the matching hooks.gmail.* setting; --hook-token inherits hooks.token.
  • Account, full topic path, hook token, and push token must be supplied or configured. run does 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 to off rather than funnel.
For run, the --topic value is the full Pub/Sub topic path (projects/.../topics/...), not just the short topic name.

Verify forwarding

Send a test from another account to the watched inbox. The watcher excludes 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.