Event Examples: Single Path Mode
Complete JSON examples for Single Path events - the simplest event type for filtering and validation.
Overview
Single Path is the default event mode. If the condition passes, the workflow continues. If it fails, the workflow exits (message ignored).
Use Cases
- Filter messages by type
- Check if required fields exist
- Validate data before processing
- Simple gate-keeping logic
Basic Single Path Event
Filter for NFL touchdown events only:
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "NFL Touchdown Filter",
"description": "Filters for touchdown events from NFL games",
"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.event.event_type",
"comparison": "equals",
"value": "touchdown"
}
]
},
"tfCondition": "Single Path",
"logicField": null,
"script": "print('Processing touchdown event for:', message.payload.game.summary.home.alias, 'vs', message.payload.game.summary.away.alias);",
"arguments": [],
"logic": []
}
Example Message That Passes:
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"type": "nfl_event",
"timestamp": "2025-11-15T00:30:13Z",
"payload": {
"game": {
"id": "dd898c90-c86f-4e50-a75f-a5fa0b2fbb00",
"title": "Thursday Night Football",
"status": "inprogress",
"quarter": 1,
"clock": "8:18",
"summary": {
"home": { "name": "Patriots", "alias": "NE", "points": 7 },
"away": { "name": "Jets", "alias": "NYJ", "points": 0 }
}
},
"event": {
"type": "event",
"event_type": "touchdown",
"description": "Touchdown by NE"
},
"metadata": {
"league": "nfl",
"event_type": "touchdown"
}
}
}
Workflow Behavior:
- ✅ Condition passes → Workflow continues to child entities
- ❌ Condition fails → Workflow exits (message ignored)
Single Path with Complex Condition
Filter for 4th quarter scoring plays:
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "4th Quarter Scoring",
"description": "Filters for touchdowns and field goals in the 4th quarter",
"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": "equals",
"value": 4
},
{
"type": "group",
"operator": "OR",
"conditions": [
{
"type": "rule",
"field": "message.payload.event.event_type",
"comparison": "equals",
"value": "touchdown"
},
{
"type": "rule",
"field": "message.payload.event.event_type",
"comparison": "equals",
"value": "field_goal"
}
]
}
]
},
"tfCondition": "Single Path",
"logicField": null,
"script": "var scoreDiff = Math.abs(message.payload.game.summary.home.points - message.payload.game.summary.away.points); print('Score differential:', scoreDiff);",
"arguments": [
{
"argumentName": "alertThreshold",
"argumentValue": "7",
"argumentDescription": "Alert if score difference is within this threshold"
}
],
"logic": []
}
Single Path with Environment Variables
Use environment variables in the script:
{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "User Signup Event",
"description": "Processes new user signups",
"workflowEntityTypeId": "event-type-uuid",
"condition": {
"type": "rule",
"field": "message.type",
"comparison": "equals",
"value": "user.signup"
},
"tfCondition": "Single Path",
"script": "print('New user:', message.user.email); print('API Key available:', typeof SPORTRADAR_API_KEY !== 'undefined');",
"arguments": [
{
"argumentName": "sendWelcomeEmail",
"argumentValue": "true",
"argumentDescription": "Whether to send welcome email"
}
],
"logic": []
}
API Endpoint
POST /api/workflow-entities
Content-Type: application/json
Best Practices
- Start simple - Add complexity only when needed
- Use AND for required conditions - All must pass
- Use OR for alternatives - Any can pass
- Test with sample messages - Verify logic before deployment
- Handle missing data - Use defaults for optional fields in scripts