Event Examples: True/False Mode
Complete JSON examples for True/False branching events - binary decision points in workflows.
Overview
True/False mode branches based on condition result. Creates two paths: one for true (condition passed) and one for false (condition failed).
Use Cases
- Premium vs free user routing
- A/B testing paths
- Feature flag branching
- Binary decision points
- Close game detection
- Validation with fallback paths
Basic True/False Event
Route based on user premium status:
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "Check Premium User",
"description": "Routes premium and free users to different flows",
"workflowEntityTypeId": "event-type-uuid",
"condition": {
"type": "rule",
"field": "message.user.premium",
"comparison": "equals",
"value": true
},
"tfCondition": "True/False",
"logicField": null,
"script": "print('User type:', message.user.premium ? 'Premium' : 'Free');",
"arguments": [],
"logic": []
}
Example Message:
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"type": "user.login",
"user": {
"id": "user-123",
"email": "john@example.com",
"premium": true,
"tier": "gold"
}
}
Workflow Behavior:
- ✅
message.user.premium === true→ Routes totruebranch - ❌
message.user.premium === false→ Routes tofalsebranch
Workflow JSON Structure
When using True/False mode, your workflow must have logic branches:
{
"nodes": {
"n1": {
"entityId": "event-entity-uuid",
"name": "Check Premium User",
"entityType": "event",
"tfCondition": "True/False",
"presentation": {
"type": "circle",
"position": { "x": 100, "y": 200 }
}
},
"n2": {
"name": "true",
"entityType": "logic-branch",
"branchValue": "true",
"presentation": {
"type": "logic-branch",
"position": { "x": 300, "y": 100 }
}
},
"n3": {
"name": "false",
"entityType": "logic-branch",
"branchValue": "false",
"presentation": {
"type": "logic-branch",
"position": { "x": 300, "y": 300 }
}
}
},
"connectors": {
"c1": {
"source": "n1",
"target": "n2",
"sourcePort": "out-true",
"targetPort": "in"
},
"c2": {
"source": "n1",
"target": "n3",
"sourcePort": "out-false",
"targetPort": "in"
}
}
}
True/False with Numeric Condition
Check if game is close (score within 7 points):
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "Is Close Game",
"description": "Determines if the game score is close",
"workflowEntityTypeId": "event-type-uuid",
"condition": {
"type": "group",
"operator": "AND",
"conditions": [
{
"type": "rule",
"field": "message.payload.metadata.league",
"comparison": "equals",
"value": "nfl"
},
{
"type": "rule",
"field": "message.payload.game.quarter",
"comparison": "greater_than",
"value": 2
}
]
},
"tfCondition": "True/False",
"script": "var homeScore = message.payload.game.summary.home.points || 0; var awayScore = message.payload.game.summary.away.points || 0; var scoreDiff = Math.abs(homeScore - awayScore); var ___result___ = scoreDiff <= 7; print('Score difference:', scoreDiff, '- Close game:', ___result___);",
"arguments": [],
"logic": []
}
Example Message:
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"type": "nfl_event",
"payload": {
"game": {
"quarter": 4,
"clock": "2:30",
"summary": {
"home": { "alias": "NE", "points": 21 },
"away": { "alias": "NYJ", "points": 17 }
}
},
"metadata": {
"league": "nfl"
}
}
}
Workflow Behavior:
- Score diff = 4 →
truebranch (close game) - Score diff > 7 →
falsebranch (not close)
API Endpoint
POST /api/workflow-entities
Content-Type: application/json
Important Notes
- result variable: You can override the condition result in the script by setting
___result___to true or false - Two branches required: Your workflow must define both true and false logic branches
- Canvas ports: The event node displays two output ports: "true" and "false"
Best Practices
- Use True/False for binary decisions
- Keep condition logic simple - complex logic should use Multi mode
- Always handle both branches in your workflow
- Test with messages that trigger both paths
- Use descriptive branch names to clarify the flow