Using Condition Nodes

Add if/else branching logic to your workflows with condition nodes.

Overview

A Condition node evaluates an expression and routes the workflow down one of two paths. If the expression is true the Yes branch runs; otherwise the No branch runs. It is Spojit's primitive for "do X when this is the case, otherwise do Y".

Condition nodes typically follow a Trigger, a Connector call, or a Transform: you fetch some data, then decide what to do based on its contents. They pair well with templates - the left side of the comparison is usually a {{ step.field }} reference and the right side is a literal value or another variable.

Configuration

  1. Add a Condition node to the canvas and connect it after the step that produces the value you want to test.
  2. Define the condition in the properties panel:
    • Left value - A template expression, for example {{ step1.total }}.
    • Operator - How to compare (equals, greater than, contains, and so on).
    • Right value - The value to compare against (literal or another template).
  3. Connect the Yes output to the path that should run when the condition is true.
  4. Connect the No output to the path that should run when it is false.

Operators

  • equals / not equals - Exact match. Types matter: the string "1" does not equal the number 1.
  • greater than / less than - Numeric comparison.
  • contains / not contains - String substring or array membership.
  • is empty / is not empty - True for blank strings, null, and empty arrays.

Combining Conditions

Click Add condition to add more rules. Then choose:

  • AND - The Yes branch runs only when every rule is true.
  • OR - The Yes branch runs when any rule is true.

Example: Route High-Value Orders

After a Connector node that fetches an order, add a Condition with left value {{ getOrder.total }}, operator greater than, right value 100. Wire the Yes branch into a Human approval node and the No branch into an automatic fulfilment Connector. Only orders over $100 require approval.

Example: Skip Empty Payloads

Right after a webhook Trigger, add a Condition with left value {{ input.items }}, operator is empty. Wire the Yes branch to a Response node that returns early, and the No branch to the rest of the workflow.

Tips

  • Hover the output handles to confirm which is Yes and which is No before connecting. Mis-wiring branches is the most common Condition bug.
  • Prefer multiple simple conditions over one complex one. Easier to read, easier to debug from the execution log.
  • For mutually exclusive paths with more than two cases, chain conditions in series rather than trying to encode everything in one node.
  • When testing, you can inspect the evaluated values in the execution log to see exactly what Spojit compared.

Common Pitfalls

  • Type coercion - {{ input.count }} from JSON might be a number, but if it came from a URL parameter it is probably a string. Compare like with like.
  • Empty vs null - is empty treats missing fields, empty strings, and empty arrays the same. If you need to distinguish, use equals against the specific shape.
  • Forgetting one branch - Leaving the No branch unconnected means the workflow simply ends down that path when the condition is false. Often that is intentional, but be sure.
  • AND vs OR confusion - For three or more rules, draw out which combinations should fire before choosing the combinator.

Related Articles

Learn More

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