Skip to main content
Webhooks expose functions and agents as HTTP endpoints. When a request arrives at a webhook path, Sinas either executes the linked function with the request data, or renders a message from the request payload and sends it to the linked agent. Key properties: How input is extracted:
  • POST/PUT/PATCH with JSON body → body becomes the input
  • GET → query parameters become the input
  • Default values are merged underneath (request data overrides)

Response modes

Raw mode

In raw mode the function’s return value becomes the response body: a dict or list is returned as JSON, a string as text/plain. This is required for providers that expect a specific response body, e.g. Slack’s Events API url_verification handshake:
For full control over status code and headers, return a dict using the reserved keys _status, _headers, and _body:

Agent targets

A webhook can trigger an agent directly, without a bridge function. The request payload is rendered through message_template (Jinja2) and sent to the agent as a user message. Undefined template variables render as empty strings — an unexpected payload shape never fails the webhook. If any variable was undefined, the rendered message is delivered with the full raw payload appended (so the agent keeps both your instructions and the data); a template that renders fully empty falls back to the raw payload alone. For multi-event sources (e.g. GitHub issues + PRs + comments), reference only fields present in every payload variant, or guard with {% if x is defined %}. With a session_key_template, repeated events that render the same key continue the same conversation (like the session_key on POST /agents/{ns}/{name}/invoke) — e.g. all events for one Jira issue or one Slack thread share a chat. Without it, each delivery starts a fresh chat.
  • sync waits for the agent’s reply and returns {"success": true, "chat_id": ..., "reply": "..."}
  • async returns 202 with {"chat_id": ..., "job_id": ...} — use this for provider webhooks
  • For authenticated webhooks the caller needs chat permission on the target agent (sinas.agents/{ns}/{name}.chat); unauthenticated webhooks run as the webhook owner
  • Deduplication works identically for both target types
Declarative config (YAML):
Function-target webhooks in YAML are unchanged (functionName: namespace/name); responseMode: raw is available for them as well.

Pipeline targets

A webhook can fire a pipeline: the request payload (merged over defaultValues) becomes the pipeline’s run input, executed as the webhook’s owner.
  • sync runs the pipeline inline (bounded by the pipeline’s syncTimeoutSeconds) and returns {"success": true, "run_id": ..., "output": ...}; a failed run returns 500 with the run_id of the replayable run record
  • async returns 202 with {"run_id": ...} — use this for provider webhooks and slow pipelines (e.g. ones containing agent steps)
  • raw is not supported for pipeline targets
  • For authenticated webhooks the caller must own the webhook and hold sinas.pipelines/{ns}/{name}.run
  • A webhook event is a single occurrence, so perUser pipelines do not fan out here — that behavior belongs to schedules and manual ?allUsers=true runs
Example (function target):
Example (agent target):
Endpoints: