Workflows
Manage automation workflows from the command line.
List Workflows
Output:
ID NAME ENABLED CREATED
550e8400-e29b-41d4-a716-446655440000 db-failover true 2024-01-15
550e8400-e29b-41d4-a716-446655440001 alert-escalation false 2024-01-10
JSON Output
View Workflow
Shows the workflow definition including nodes and connections.
List Operations
Shows all available workflow operations:
OPERATION DESCRIPTION OUTPUT TYPE
AND Both inputs must be true boolean
OR At least one must be true boolean
NOT Inverts the input boolean
EQUALS Compare two values boolean
SET_STATUS Change asset status action
SET_GROUP Set group status action
SET_TRAFFIC Control traffic action
SET_CAMERA Control camera action
Create Workflow
Workflow JSON Format
{
"name": "My Workflow",
"enabled": true,
"graph": {
"nodes": [
{
"id": "input1",
"type": "input",
"asset_id": "building-uuid-1",
"condition": {
"field": "status",
"operator": "equals",
"value": "offline"
}
},
{
"id": "input2",
"type": "input",
"asset_id": "building-uuid-2",
"condition": {
"field": "status",
"operator": "equals",
"value": "offline"
}
},
{
"id": "logic1",
"type": "AND",
"inputs": ["input1", "input2"]
},
{
"id": "output1",
"type": "SET_STATUS",
"target_id": "building-uuid-3",
"value": "critical",
"inputs": ["logic1"]
}
]
}
}
Node Types
Input Node:
{
"id": "unique-id",
"type": "input",
"asset_id": "building-uuid",
"condition": {
"field": "status",
"operator": "equals",
"value": "offline"
}
}
Logic Node:
Output Node:
{
"id": "unique-id",
"type": "SET_STATUS",
"target_id": "building-uuid",
"value": "critical",
"inputs": ["logic-node-id"],
"latch": true,
"latch_value": "critical"
}
Enable/Disable Workflow
Disabled workflows don't process inputs.
Export Workflow
Exports the workflow as JSON for backup or migration.
Backup All Workflows
#!/bin/bash
for wf in $(wt workflow list --json | jq -r '.[].id'); do
wt workflow export $wf > "workflow_${wf}.json"
echo "Exported: $wf"
done
Delete Workflow
Cannot be undone
Deleted workflows cannot be recovered. Export first if needed.
Example Workflows
Database Failover Alert
When both database servers are offline, mark the API as critical:
{
"name": "db-failover",
"enabled": true,
"graph": {
"nodes": [
{
"id": "db1-check",
"type": "input",
"asset_id": "db-server-1-uuid",
"condition": {"field": "status", "operator": "equals", "value": "offline"}
},
{
"id": "db2-check",
"type": "input",
"asset_id": "db-server-2-uuid",
"condition": {"field": "status", "operator": "equals", "value": "offline"}
},
{
"id": "both-down",
"type": "AND",
"inputs": ["db1-check", "db2-check"]
},
{
"id": "alert-api",
"type": "SET_STATUS",
"target_id": "api-server-uuid",
"value": "critical",
"inputs": ["both-down"],
"latch": true
}
]
}
}
All-Clear Status
When all services are online, set the status dashboard to online:
{
"name": "all-clear",
"enabled": true,
"graph": {
"nodes": [
{
"id": "svc1-online",
"type": "input",
"asset_id": "service-1-uuid",
"condition": {"field": "status", "operator": "equals", "value": "online"}
},
{
"id": "svc2-online",
"type": "input",
"asset_id": "service-2-uuid",
"condition": {"field": "status", "operator": "equals", "value": "online"}
},
{
"id": "all-online",
"type": "AND",
"inputs": ["svc1-online", "svc2-online"]
},
{
"id": "update-dashboard",
"type": "SET_STATUS",
"target_id": "status-dashboard-uuid",
"value": "online",
"inputs": ["all-online"]
}
]
}
}
Workflow Tips
Start simple
Begin with single input → output workflows, then add complexity.
Use latch wisely
Latch prevents flapping but requires manual reset. Use for critical alerts.
Test in dev
Create and test workflows in a dev context before deploying to production.
Export regularly
Export workflows as part of your backup strategy.