Skip to main content

Workflows

Workflows are a JSON-based orchestration engine that lets you build complex automation pipelines using a visual editor. A workflow is a directed graph of nodes that can call functions, transform data, handle conditions, iterate over collections, and more. Workflows can be executed manually, triggered via API, or scheduled as periodic jobs.

UI page

You can find all workflows here

Properties

PropertyTypeDescription
idstringUnique identifier of the workflow
namestringDisplay name of the workflow
descriptionstringDescription of the workflow
tagsarray of stringTags associated to the workflow
metadataobjectKey/value metadata associated to the workflow
configobjectThe root node configuration (JSON object describing the node graph)
jobobjectOptional job scheduling configuration (see below)
functionsobjectMap of custom reusable functions defined within the workflow
test_payloadobjectJSON object used as input when testing the workflow from the UI
orphansobjectDisconnected nodes and edges stored by the visual editor
notesarrayVisual annotations placed on the workflow canvas in the editor

Job configuration

A workflow can optionally be scheduled as a periodic job:

PropertyTypeDescription
enabledbooleanWhether the job scheduling is enabled
cronstringA cron expression defining when the workflow should run (e.g., */5 * * * * ? for every 5 seconds)
configobjectAdditional job configuration

Node types

Workflows are composed of nodes. Each node has a type that determines its behavior:

Control flow

Node typeDescription
workflowSequential execution of child nodes
ifConditional branching (if/then/else)
switchMulti-path conditional branching based on value matching
foreachIterate over an array and execute a node for each element
mapTransform each element of an array
filterFilter elements of an array based on a predicate
flatmapTransform and flatten arrays
parallelExecute multiple nodes in parallel
whileLoop while a condition is true
tryTry/catch/finally error handling
jumpJump to another node in the workflow
asyncExecute a node asynchronously

Data

Node typeDescription
callInvoke a built-in or custom function
assignAssign a value to a variable in workflow memory
valueReturn a static value

Execution control

Node typeDescription
errorRaise an error
waitWait for a specified duration
pausePause workflow execution
endTerminate the workflow
breakpointDebugging breakpoint in the visual editor

Built-in functions

Workflows provide a rich set of built-in functions that can be called from call nodes:

CategoryFunctionsDescription
HTTPhttp_clientMake HTTP requests to any endpoint
Storagestore_get, store_set, store_del, store_keys, store_matchPersistent key-value storage operations
Statestate_get, state_get_allAccess Otoroshi proxy state (routes, backends, certificates, etc.)
Configurationconfig_readRead Otoroshi global configuration
Filesfile_read, file_write, file_delFile system operations
WASMwasm_callCall WebAssembly functions
Workflowsworkflow_callCall other workflows (composition)
Eventsemit_eventEmit custom events to the data exporter pipeline
Emailsend_mailSend emails
Systemsystem_callExecute system commands
LogginglogLog messages to the Otoroshi logger

You can also define custom functions in the functions map of the workflow entity.

JSON example

Here is a simple workflow that fetches data from an HTTP endpoint and logs the result:

{
"id": "workflow_fetch_and_log",
"name": "Fetch and log",
"description": "Fetches data from an API and logs the response",
"tags": ["example"],
"metadata": {},
"config": {
"type": "workflow",
"nodes": [
{
"type": "call",
"id": "fetch_data",
"function": "http_client",
"args": {
"url": "https://api.example.com/data",
"method": "GET",
"headers": {
"Accept": "application/json"
}
}
},
{
"type": "call",
"id": "log_result",
"function": "log",
"args": {
"message": "${nodes.fetch_data.response.body}"
}
}
]
},
"job": {
"enabled": false,
"cron": "0 */5 * * * ?",
"config": {}
},
"functions": {},
"test_payload": {},
"orphans": { "nodes": [], "edges": [] },
"notes": []
}

Scheduled workflow example

A workflow that periodically checks the health of all backends:

{
"id": "workflow_health_check",
"name": "Periodic health check",
"description": "Checks the health of all backends every minute",
"tags": ["monitoring"],
"metadata": {},
"config": {
"type": "workflow",
"nodes": [
{
"type": "call",
"id": "get_backends",
"function": "state_get_all",
"args": {
"entity": "backends"
}
},
{
"type": "foreach",
"id": "check_each",
"array": "${nodes.get_backends.result}",
"node": {
"type": "call",
"function": "http_client",
"args": {
"url": "${item.backend.targets[0].hostname}",
"method": "GET",
"timeout": 5000
}
}
}
]
},
"job": {
"enabled": true,
"cron": "0 * * * * ?",
"config": {}
}
}

Learn more

For detailed information about node configuration, operators, expression syntax, and examples, see Otoroshi Workflows.

For information about the visual editor, debugging tools, and breakpoints, see Workflows Editor.