Handler recipes
Five copy-paste recipes for receiving Cortex-dispatched triggers, signed and verified. All five sit behind the same trigger dispatch contract; pick the runtime you're already using.
Durable execution + automatic retries on the customer side. The persona-fit pick for TypeScript-first teams.
Best for: TS teams wanting checkpoint-resume + retry budget for free.
Self-hosted or n8n Cloud. Visual workflow editor with HTTP Webhook + Function nodes. Apache 2.0.
Best for: Teams that want a no-code/low-code workflow runtime they can host themselves.
Catch Hook trigger + Code (JavaScript) step for signature verification. Broadest connector reach.
Best for: Reach over depth — when you want to feed triggers into one of Zapier’s 7000 app integrations.
Your own Express / Hono / FastAPI endpoint + @cortex/sdk-ts. Production-grade option.
Best for: Teams that already run a server and want full control over execution.
Cortex dispatches as MCP tool call into your MCP server. ADR-0019 Tier 2. Documented now; ships V1.1.
Best for: Teams already exposing internal capabilities via MCP and wanting Cortex as a client.
What every recipe covers
- Register a handler via
handler.register(one call, returns awebhook_secret). - Verify the signature on every inbound POST using the canonical
timestamp + "." + bodystring. 5-minute replay window. Reject stale or mismatched signatures with401. - Execute the action through whatever channel the recipe's runtime exposes (Slack node, email step, custom function, etc).
- Call back
trigger.complete(ortrigger.reverse) with the outcome and your external reference id. - Handle retries — Cortex dedupes via
X-Cortex-Idempotency-Key. Your handler must too.
Cross-cutting references
- Trigger dispatch protocol — envelope, signing, retries, DLQ, three handler tiers.
- Envelope & headers reference — field-level schema for every action class.
- Callbacks reference — outcome semantics, reversal contract, ledger linkage.
- Error codes — resolution steps for
signature_invalid,handler_disabled,idempotency_conflict.