Webhook and Code: Signature-Routed Event Dispatcher Template

Build a single webhook endpoint in Spojit that inspects each incoming event with the code connector and dispatches each event type to its own Subworkflow.

What It Builds

This template creates one Webhook trigger that accepts every event a system sends to a single URL, then uses a Connector node on the code connector (execute-javascript) to read the event type out of the parsed body and normalize it into one routing key. A Condition node fans that key out to a different Subworkflow node per kind of event, so each event type runs its own dedicated handler workflow. The result is the classic single-endpoint dispatcher: one public URL in, many specialized handlers out.

The Prompt

Paste this into Miraxa and it builds the workflow, connecting the tools for you:

Build a workflow with a Webhook trigger that receives events from an external system. Add a Connector node on the code connector using execute-javascript to read the event type from {{ input }} and output a single routingKey field. Then add Condition branches that route each routingKey value to a different Subworkflow node, with one fallback Subworkflow for unrecognized types. Return a 202 acknowledgement to the caller as soon as the event is accepted.

Connectors Used

  • Webhook trigger - the single public URL every event posts to, verified by HMAC through a signing connection (Spojit, Shopify, GitHub, Slack, or Custom scheme). The parsed JSON body is available as {{ input }}.
  • code - execute-javascript reads the event type out of the body (for example a header field, an event property, or an action name) and returns one tidy routingKey.
  • Subworkflow node - one per event type, each holding the real handler logic for that kind of event, so handlers stay small and reusable.

Customize It

Change the field your execute-javascript step reads to match your source system (some send the type in a header, others in the body). Add or remove Condition branches and their matching Subworkflow nodes as your event catalog grows, and point each branch at the workflow that should own that event. If you want the caller to get more than a bare acknowledgement, add a Response node so Spojit returns a synchronous result instead of the default 202.

Tips

  • Keep the execute-javascript routing step in Direct mode: classifying a known field is deterministic, so you avoid AI credit cost. Reserve Agent mode for branches that genuinely need judgment.
  • Always include a fallback Subworkflow (or a Send Email alert) for routing keys you do not recognize, so new event types never vanish silently.
  • Each Subworkflow appears as its own entry in execution history, which makes it easy to see exactly which handler ran for a given event.

Related

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.