Gmail Pub/Sub -> Fased
Recommended flow:Gmail watch -> Pub/Sub push -> gog gmail watch serve -> Fased webhook
This keeps the message content off the public internet as much as possible and
fits Fased’s private-ingress model.
What you need
gcloudinstalled and logged ingog/gogcliinstalled and authorized for the Gmail account- Fased webhook ingress enabled
tailscalelogged in if you want the supported public HTTPS path
- Tailscale Funnel
Minimal webhook config
channel: "last"reuses the last route known to the target Agent/session- if you want deterministic delivery, set both
channelandto - Gmail hook content is wrapped with external-content safety boundaries by default
- to disable that wrapper, set
hooks.gmail.allowUnsafeExternalContent: trueonly for tightly controlled environments
- mapping-level
model/thinking hooks.gmail.model/hooks.gmail.thinking- normal agent defaults
provider/model ref.
If you are not sure which model to use, omit the mapping-level model and let
the target Agent use its configured primary/fallback model.
Recommended setup: wizard
- enables the Gmail webhook preset
- writes the
hooks.gmailconfig used byfased webhooks gmail run - prefers Tailscale Funnel for the public push endpoint
- when
tailscale.modeis enabled, Fased setshooks.gmail.serve.pathto/ - the public path stays at
hooks.gmail.tailscale.path, default/gmail-pubsub - if you need the backend to keep the prefixed path, set
hooks.gmail.tailscale.targetto a full URL likehttp://127.0.0.1:8788/gmail-pubsub
- on macOS the helper can install
gcloud,gogcli, andtailscalevia Homebrew - on Linux, install them yourself first
Gateway auto-start
When these are set:hooks.enabled = truehooks.gmail.accountis configured
gog gmail watch serve on boot and keeps the watch renewed.
Opt out:
One-time Google Cloud setup
- Select the GCP project that owns the OAuth client used by
gog
- Enable the required APIs
- Create the Pub/Sub topic
- Let Gmail publish into that topic
- the Pub/Sub topic must live in the same GCP project as the OAuth client used for the Gmail watch
Start the Gmail watch
history_id if you want a clean debugging baseline.
Run the push handler directly
--tokenprotects the push endpoint seen by Pub/Sub--hook-urlshould point at your Fased webhook mapping such as/hooks/gmail--include-bodyand--max-bytescontrol how much message content reaches Fased
fased webhooks gmail run is the cleaner wrapper.
Non-Tailscale public ingress
You can expose the Gmail push handler through another tunnel, but that is an advanced, unsupported path. Example:Test the flow
Send a message to the watched inbox:Troubleshooting
Invalid topicName- the topic lives in the wrong project
User not authorized- the Gmail push service account is missing publisher access
- empty messages
- Gmail push only carries
historyId; fetch message details throughgog gmail history
- Gmail push only carries