If

Branches workflow execution based on a boolean condition. When the condition evaluates to true, execution follows the true branch; otherwise it follows the false branch.

When to Use

Use If when you need a binary decision:

  • Did the HTTP request succeed? (input.status == 200)
  • Is the user on the Pro plan? (input.body.plan == "pro")
  • Does the payload contain a required field? (input.body.email)

For more than two outcomes, use Switch instead.

Inputs

HandleTypeDescription
inputanyThe value to evaluate the condition against. Optional.

Outputs

None. If has no data output handles. Execution continues through one of these control branch handles:

HandleTypeDescription
truecontrolExecution continues here when the condition is true.
falsecontrolExecution continues here when the condition is false.

Data from the input handle is passed through to whichever branch executes. The downstream node on either branch receives the same value that was wired into input.

Settings

SettingTypeRequiredDescription
conditionexpressionYesBoolean expression evaluated against input. Supports template bindings. Example: input.body.status == 200

The condition field accepts bare Python expressions — no {"{{ }}"} wrapper needed. Comparison operators: ==, !=, >, <, >=, <=. Logical operators: and, or, not.

Use eq(input.status, 200) instead of == when comparing values that might be strings or numbers (common with webhook payloads). Reference a field directly to check if it exists — missing fields return None (falsy).

Example

Canvas

Check if an HTTP request succeeded before sending a notification:

Webhook → HTTP Request → If (input.status == 200) → true: Send Email
                                                    → false: Stop

If settings:

  • Condition: input.status == 200

TSL

import webhook from @tensorify/webhook-trigger:4.0.0
import http_request from @tensorify/http-request:3.0.0
import check_status from @tensorify/if:3.0.0
import send_email from @tensorify/resend-send-email:1.0.0
import halt from @tensorify/stop:3.0.0

node trigger @tensorify/webhook-trigger:4.0.0 {
    path = "/notify"
    method = "POST"
    provider = "generic"
}

node fetch @tensorify/http-request:3.0.0 {
    method = "GET"
    url = "https://api.example.com/status"
    timeout = 30
}

node gate @tensorify/if:3.0.0 {
    condition = "input.status == 200"
}

node notify @tensorify/resend-send-email:1.0.0 {
    to = "[email protected]"
    subject = "Status check passed"
}

node stop_node @tensorify/stop:3.0.0

trigger.payload -> fetch.body
fetch.response -> gate.input
gate.true -> notify.input
gate.false -> stop_node.input

Common Gotchas

  • You do not need to connect both true and false outputs. Leave a branch unconnected if you want execution to simply stop on that path.
  • If the condition references a variable that does not exist, it evaluates to false.
  • String comparisons are case-sensitive: "Pro" is not equal to "pro". Use lower() for case-insensitive checks.
  • Use eq() instead of == when comparing values that might be strings or numbers (common with webhook data).
  • Old workflows with {"{{ }}"} in conditions still work — the runtime strips them automatically. New workflows should use bare expressions.

See Also

On this page