Skip to main content

Triggers

Run a published workflow automatically — on a schedule, in response to an HTTP call, or when a business event occurs.

In addition to the Run panel and the manual POST /api/v1/agent-workflows/{id}/run API, a workflow fires based on a cron schedule, an incoming webhook, or a business event from the Event Bus. All three are configured from the Triggers panel in the workflow editor (the bolt icon), or through the API.

Published workflows only

All trigger types refuse to fire a workflow that isn't in published status. Stage and publish the workflow first.


Cron Triggers​

Run a workflow on a recurring schedule using standard 5-field cron syntax.

Creating a cron trigger​

  1. Open the workflow in the editor and click the Triggers button.
  2. Click + Cron Schedule.
  3. Fill in:
FieldDescription
NameHuman-readable label (e.g. "Daily 9am summary"). Required — a blank name is refused (422)
Cron ExpressionStandard 5-field cron syntax: minute hour day-of-month month day-of-week. Anything else, including a 6-field expression with seconds, is refused (400)
TimezoneIANA timezone name (default UTC). An unknown name is refused (400)
Input TemplateText passed as the workflow's input on each fire. Supports {date} and {now} placeholders, rendered in the trigger's timezone

Example expressions:

ExpressionMeaning
0 9 * * 1-59:00 AM, Monday–Friday
*/15 * * * *Every 15 minutes
0 0 1 * *Midnight on the 1st of every month

Example input template:

Generate the daily summary for {date}. Current time: {now}.

{date} is the date in the trigger's timezone (e.g. 2026-10-29), and {now} the time there with its offset (e.g. 2026-10-29T09:00:00.123456+05:30).

Template format errors

An unrecognized placeholder (e.g. {user}) is left as literal text, and {date} and {now} are still filled in. If the template's syntax is invalid (for example a lone {), the template is used verbatim and a warning is logged. Either way the cron trigger still fires.

How firing works​

A background scheduler checks for due triggers every 60 seconds. When a cron trigger's next_run_at has passed:

  1. The trigger is atomically claimed (its schedule is advanced immediately, so it can't be double-fired if multiple app instances are running).
  2. The workflow runs with the rendered input template.
  3. last_run_at and run_count are updated when the run is queued. The run's own outcome is in the workflow's run history.

If the workflow isn't published when the trigger is due, that run is skipped and the trigger's last_error says why. The next successful fire clears it.

No external scheduler (cron job, Celery beat, systemd timer) is required — firing happens automatically inside the app.

Manual tick (admin/debugging)​

http
POST /api/v1/triggers/cron/tick
Authorization: Bearer <admin-token>

Admins can call this directly to fire all currently-due cron triggers on demand, without waiting for the next automatic tick — useful for testing a new cron trigger immediately after creating it.


Webhook Triggers​

Expose a public URL that fires the workflow whenever it receives an HTTP POST.

Creating a webhook trigger​

  1. Open the Triggers panel and click + Webhook.
  2. Give it a name and optionally restrict it to specific source IPs. Entries can be single addresses (203.0.113.7) or CIDR ranges (10.0.0.0/8, 2001:db8::/32).
  3. Click Create — the response shows:
    • Webhook URL — the public https:// endpoint to POST to. See How the webhook URL is built.
    • Signing Secret — shown once. Store it immediately; it cannot be retrieved again. It never appears in any other API response, including the trigger list.

Over the API you can also set max_runs_per_minute to cap how often this webhook can fire. Further calls in the same minute get 429. 0, the default, means only the instance-wide limit applies (WEBHOOK_RATE_LIMIT_PER_MINUTE, default 120 per minute per webhook).

Save the signing secret immediately

The signing secret is only ever shown at creation time. If you lose it, delete the trigger and create a new one.

How the webhook URL is built​

The URL must be the address senders really use. An http:// URL behind a TLS proxy redirects to https://, and most webhook senders don't follow a redirect on a POST, so the call never arrives. Studio picks the base URL in this order:

  1. The instance's configured URL: Admin Panel → Settings → General → Hrida.ai URL (HRIDAAI_URL, which SSO needs too), or the older HRIDA_AI_URL environment variable. Set it to the public https:// address in production. An http:// value is upgraded to https:// when the request itself came in over https.
  2. The proxy's forwarded headers: X-Forwarded-Proto: https, X-Forwarded-Scheme, X-Forwarded-Ssl: on or Forwarded: proto=https, with X-Forwarded-Host.
  3. The browser's own address: a webhook created in the editor on https://… gets an https:// URL even without the headers above.
  4. Otherwise, the address the Studio server saw, which behind a proxy is often http://.

A webhook created over the API by a script (no browser Origin) on a server with no configured URL and no forwarded headers gets an http:// URL. The webhook still works if you call it on https://.

Firing the webhook​

http
POST /api/v1/triggers/webhook/{token}
Content-Type: application/json
X-Hrida-Signature: sha256=<hmac_hex>
X-Hrida-Timestamp: <unix_seconds>

{
  "input": "New support ticket: customer reports a billing discrepancy"
}
  • The request body's input (or message) field becomes the workflow's input. If neither is set (or it's empty), the whole JSON body is passed on as JSON text. If the body isn't valid JSON, the raw body is used as the input text.
  • Returns 202 Accepted immediately — the workflow runs asynchronously.
  • If allowed_ips was configured, requests from source IPs outside those addresses and ranges are rejected with 403.
  • A malformed or incorrect X-Hrida-Signature is rejected with 401.
  • A body over 1 MB (WEBHOOK_MAX_BODY_BYTES) is rejected with 413.
  • If the workflow isn't published, the request is rejected with 409, and the trigger's last_error records it.
Send X-Hrida-Timestamp for replay protection

Two signing schemes are accepted:

  • Timestamped (recommended) — also send X-Hrida-Timestamp: <unix_seconds> and sign f"{timestamp}.".encode() + body instead of the bare body. A request whose timestamp is more than WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS (default 300s) from the server's clock is rejected with 401 — so a captured, valid (body, signature) pair can't be replayed indefinitely by whoever intercepts it.
  • Legacy (bare body, no timestamp) — still accepted for callers configured before this scheme existed (hmac.new(secret, body, sha256)), but has no replay protection: an intercepted request stays valid forever. Migrate to the timestamped scheme when you can.

If you send X-Hrida-Timestamp, the signature must be computed over the timestamp-prefixed payload — a legacy (bare-body) signature will not validate once a timestamp header is present.

Response​

json
{
  "accepted": true,
  "trigger_id": "...",
  "workflow_id": "...",
  "run_id": "run_abc123"
}

The run_id is created synchronously before the workflow is queued. Use it to poll GET /api/v1/agent-analytics/workflows/{workflow_id}/runs for the run's status and output — no need to scan the full run list.

This confirms the request was accepted and queued — not that the workflow succeeded.


Incident Triggers​

Fire a workflow automatically when a configured incident provider (e.g. Grafana OnCall) reports a state change — an alert firing, being acknowledged, or resolved. Unlike cron and webhook triggers, an incident trigger isn't a separate trigger object — it's a single setting stored directly on the workflow (graph.meta.oncall_trigger), saved immediately when you change it.

Requires a configured incident provider

Incident triggers only fire if at least one incident provider is set up in Admin Panel → Incidents → Providers. See Grafana OnCall Provider for the full setup guide.

Setting an incident trigger​

  1. Open the workflow in the editor and click the Triggers button.
  2. Under Incident Trigger, choose which state change should fire the workflow:
OptionFires when
DisabledNever (default)
On FiringAn incident enters the firing state
On AcknowledgedAn incident is acknowledged
On ResolvedAn incident is resolved
Any state changeAny of the above

The selection saves automatically — there's no separate "Create" step like cron or webhook triggers, and it doesn't appear in the trigger list described under Managing triggers below since it isn't a WorkflowTrigger row.

How firing works​

  1. The incident provider POSTs a webhook to /api/v1/webhooks/incidents/{provider_id} (configured on the provider side — see the provider's own setup doc).
  2. hrida-ai-studio normalizes the payload into an internal event and deduplicates retries — the same provider + incident + state combination within 60 seconds is ignored.
  3. Every published workflow whose Incident Trigger setting matches the event's state (or is set to Any state change) fires — a single incident event can trigger more than one workflow.

Reading incident data inside the workflow​

The fired workflow's input is the incident event serialized as JSON:

json
{
  "provider_id": "...",
  "provider_type": "grafana_oncall",
  "incident_id": "...",
  "state": "firing",
  "title": "High CPU on web-3",
  "severity": "critical",
  "created_at": "2026-07-17T10:15:00Z",
  "acknowledged_at": null,
  "resolved_at": null,
  "permalink": "https://..."
}
Parsing this inside the workflow

This arrives as the workflow's plain-text input, not under a state._event key the way event subscription payloads do. The sandboxed expression evaluator used by transform/set_state/if_else nodes does not expose a JSON parser, so you can't do json.loads(input) in a node expression. Use an agent node and ask the LLM to read the relevant fields out of the JSON text instead.


Managing Triggers​

The Triggers panel lists every cron and webhook trigger for the current workflow:

ActionEffect
Toggle enabledPause/resume firing without deleting the trigger. Re-enabling a cron trigger schedules its next run from now, so it doesn't fire at once for a time missed while it was off
DeletePermanently remove the trigger. Webhook URLs and cron schedules stop working immediately

Each trigger shows run_count, last_run_at, next_run_at (cron) and last_error. last_error holds the latest reason the trigger couldn't start a run (for example, the workflow wasn't published) and is cleared by the next successful fire.

Who can do what:

ActionNeeds
List triggersRead access to the workflow (its owner, a member of its space, or an admin)
Create, enable/disable, editagent_developer or higher on the workflow (the owner counts as agent_developer)
Deletelifecycle_manager or higher, or the workflow's owner

Editing a trigger over the API​

http
PATCH /api/v1/agent-workflows/{workflow_id}/triggers/{trigger_id}
{ "name": "...", "enabled": true, "config": { "cron_expr": "30 4 * * *" } }
  • config is merged into the existing config: keys you don't send are kept.
  • The webhook URL token and signing secret can't be changed this way. Delete and recreate the trigger to rotate them.
  • The new config is checked with the same rules as create: cron expression and timezone, IP entries, max_runs_per_minute, event type, concurrency and filter. An invalid value returns 422 and nothing changes.
  • A changed cron expression or timezone takes effect immediately: next_run_at is recalculated.
  • Changing catalog_id or space_id is checked like at creation (see Catalog and space scoping).
Trigger changes are audited

Creating, enabling/disabling, updating, or deleting any trigger is recorded in the parent workflow's Audit Log as an UPDATE entry — including who made the change and, for edits, a before/after diff. Webhook signing secrets are always redacted from the audit record.


Catalog and Space Scoping​

Cron, webhook and event triggers accept an optional catalog_id and space_id at creation. When set, the fired run uses that catalog/space's credentials and access policies. When omitted, the run uses the workflow's own space (and its catalog), or the instance's global LLM credentials if the workflow has no space.

Because these decide whose credentials a run uses, they're checked:

ValueRule
space_idMust exist (404 otherwise), and you need agent_developer, lifecycle_manager or space_admin in it (403 otherwise)
catalog_idMust exist (404). With a space_id, the space must be in that catalog (422). Without one, non-admins can only use the workflow's own catalog (403)

Event Subscription Triggers​

Fire a workflow whenever a specific business event arrives on the Event Bus. Unlike webhooks (one sender, one receiver) event subscriptions support fan-out — multiple workflows can subscribe to the same event type and all fire independently.

Creating an event subscription​

In the editor: open the Triggers panel (the bolt icon) and expand Add event subscription. The workflow must be saved and published first.

FieldWhat to enter
NameA label for the subscription (required)
Event typeThe event to listen for, e.g. order_created (required)
Filter expressionOptional condition on the event, e.g. payload['status'] == 'published'
ConcurrencyParallel runs every matching event at once; One per correlation runs one at a time per correlation ID

Click Create event subscription.

With the API:

bash
curl -X POST "http://localhost:8080/api/v1/agent-workflows/{workflow_id}/triggers/event" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name":        "On leave_applied",
    "event_type":  "leave_applied",
    "filter_expr": "payload.get(\"days\", 0) > 5",
    "concurrency": "one_per_correlation"
  }'
FieldDescription
event_typeEvent type string to subscribe to (e.g. leave_applied, invoice_received)
filter_exprOptional Python expression evaluated against the event. Variables: payload (dict), event (full event). Return True to fire, False to skip. Checked when saved: a syntax error or a name other than payload, event and the expression helpers (len, any, …) is refused with 400. A filter that fails on a particular event (e.g. a missing key with payload['days']) counts as no match; use payload.get('days', 0) for optional keys.
concurrencyparallel (default) — fire for every matching event. one_per_correlation — skip if a run is already active for the same correlation_id.

Each fire updates the trigger's run_count and last_run_at, and the run shows as Event in the Runs panel, with the event JSON as its input. Without a space_id, the run uses the workflow's own space.

Reading event data inside the workflow​

When fired by an event subscription the initial workflow state contains:

json
{
  "_event": {
    "id":             "evt_abc123",
    "type":           "leave_applied",
    "payload":        { "employee_id": "EMP001", "days": 5 },
    "correlation_id": "EMP001",
    "source":         "hridaone"
  }
}

The workflow input (passed to the first agent node) is the event serialized as JSON. Agent nodes can read state._event.payload directly.

How events are published​

External systems and internal workflows both publish to the same Event Bus:

bash
# External system (API key, no JWT)
POST /api/v1/events/ingest
X-Api-Key: <HRIDA_EVENT_API_KEY>

# Admin / internal (JWT required)
POST /api/v1/events
Authorization: Bearer <admin_token>

# From inside a workflow — use the emit_event built-in tool

See Event-Driven Workflows for the full event model and Saga Orchestration for coordinating multi-step processes.


Trigger Comparison​

CronWebhookIncidentEvent Subscription
Trigger sourceTime scheduleExternal HTTP POSTIncident provider state changeBusiness event on Event Bus
Configured inTriggers panel (UI)Triggers panel (UI)Triggers panel (UI)Triggers panel (UI) or API
Stored asWorkflowTrigger rowWorkflowTrigger rowgraph.meta.oncall_trigger on the workflowWorkflowTrigger row
Fan-outNoNoYes — one incident can fire multiple matching workflowsYes — multiple workflows per event
PayloadInput template with {date} / {now}Request bodyIncident event as JSON textEvent payload + full event context
Authn/aHMAC-SHA256 signaturen/a (provider webhook auth handled per-provider)API key (external) or JWT (admin)
Saga supportNoNoNoYes — correlation_id links events
Filtern/aIP allowlistIncident state (firing/acknowledged/resolved/any)Python expression on payload

Hrida.ai is proprietary software of Zlabs Innovation. See the license for terms. © 2026 Zlabs Innovation.