Webhooks
Fased can expose a small authenticated HTTP ingress for trusted automation. Use it when another system needs to wake the main session, run an isolated agent turn, or map external payloads into Fased work. This is not meant to be a wide-open public API. Treat it as private ingress and keep it behind loopback, Tailscale, or a trusted reverse proxy. Inbound automation uses the gateway Hooks surface documented below. The normal UI is Agent > Tasks > Webhook Triggers, where operators create authenticated trigger paths next to scheduled tasks while keeping the same token, route, and Agent policy boundaries.Enable webhook ingress
hooks.tokenis required whenhooks.enabled = truehooks.pathdefaults to/hookshooks.allowedAgentIdscontrols explicitagentIdrouting- omit it or include
"*"to allow any agent id - set
[]to block all explicitagentIdrouting - unknown explicit ids resolve to the default Agent before the allowlist check
- omit it or include
Auth
Every request must send the hook token. Accepted forms:Authorization: Bearer <token>(preferred)x-fased-token: <token>
- query-string tokens such as
?token=...
Endpoint: POST /hooks/wake
Payload:
textrequiredmodeoptional:nowornext-heartbeat
- queues a system event for the main session
- if
mode = "now", triggers an immediate heartbeat
Endpoint: POST /hooks/agent
Payload:
messagerequirednameoptional label used in summariesagentIdoptional; unknown ids resolve to the default AgentsessionKeyoptional; rejected by default unlesshooks.allowRequestSessionKey = truewakeModeoptional:nowornext-heartbeatdeliveroptional, defaults totruechanneloptional, defaults tolasttooptional recipient for the chosen channelmodel,thinking,timeoutSecondsoptional run overrides
- starts an isolated agent turn
- posts a summary into the main session
- optionally delivers the run output to a chat target
Session-key policy
Caller-selected session keys are off by default. Recommended config:sessionKey, lock it down with prefixes.
Mapped endpoints: POST /hooks/<name>
Named paths are resolved through hooks.mappings. Use Agent > Tasks >
Webhook Triggers for the common case. It creates a mapping, enables
hooks.enabled, generates a hook token on first save when needed, and shows the
endpoint URL. Manual config is still available for advanced operators.
Agent Trigger Modal
The + Trigger button in Agent > Tasks creates a saved Trigger definition, not a scheduled Task. The selected Agent owns the definition. Every matching POST creates a run-history row withdefinitionKind = "trigger"; if the target
is a workflow or graph, the workflow run is linked by the same correlation id.
Fields:
| Field | Meaning |
|---|---|
| Name | Human label shown under the Agent’s Trigger definitions. |
| Path | Endpoint path under the configured hooks base path, for example /hooks/release. |
| Run target | Agent prompt, Workflow / graph, or Heartbeat wake. |
| Run timing | Run now starts immediately; Next heartbeat queues work for the Agent heartbeat loop. |
| Workflow target | Saved workflow or graph to run when the Trigger fires. |
| Delivery | Internal only records history; Deliver reply also sends the Agent reply. |
| Prompt template | Template for Agent prompt or wake text. Supports {{payload}}, {{headers}}, {{path}}, and {{now}}. |
| Reply channel/target | Optional delivery route used only when delivery is enabled. |
| Timeout | Optional Agent turn timeout in seconds. |
| Notify | Run-history notification policy: silent, done only, or state changes. |
wakeactions- isolated
agentactions - saved
workflowor graph actions
hooks.presets: ["gmail"]enables the built-in Gmail mappinghooks.mappingsdefinesmatch,action, templates, delivery, and routinghooks.transformsDirplustransform.moduleloads custom JS/TS transformsagentIdlets a mapping route to a specific agenthooks.defaultSessionKeyprovides the fallback session key{{payload}}or{{body}}inserts the full JSON payload in templates{{headers}}inserts request headers for diagnosticsallowUnsafeExternalContent: truedisables the external-content safety wrapper for that mapping
hooks.transformsDirmust stay under your Fased config tree, typically~/.fased/hooks/transformstransform.modulemust resolve inside the effective transforms directory- path escape / traversal attempts are rejected
fased webhooks gmail setupwriteshooks.gmailconfig forfased webhooks gmail run- the full flow is documented in Gmail Pub/Sub
Response codes
200for wake actions202for agent or workflow actions204when a mapping transform intentionally skips the payload400for invalid payloads401for auth failure404when no mapped endpoint matches the path405for non-POST requests408when the request body times out413for oversized payloads429after repeated auth failures from the same client500when a mapping transform fails unexpectedly
Examples
Wake the main session:model and let the Agent use its primary/fallback model settings.
Mapped Gmail payload:
Security
- keep webhook ingress on loopback, a tailnet, or behind a trusted reverse proxy
- use a dedicated hook token, not your main gateway auth token
- repeated auth failures are rate-limited per client address
- if you expose multi-agent routing, set
hooks.allowedAgentIds - keep
hooks.allowRequestSessionKey = falseunless you truly need it - if request session keys are enabled, restrict them with
hooks.allowedSessionKeyPrefixes - avoid dumping raw third-party payloads into logs
- external content is treated as untrusted by default; only set
allowUnsafeExternalContent: truefor tightly controlled internal feeds