Skip to content

Engine

The engine node uses the Smartunit Engine Provider to read or change deployed Node-RED flows.

High-impact node: Update Flows, Create Node, and Update Node change the running flow configuration. Restrict access, validate every payload, and keep a recoverable copy of known-good flows.

ActionCurrent behavior
AutoRequires msg.action for every input.
Get tabsReturns flow-tab definitions.
Get flowsReturns flow configuration for the selected scope.
Get nodesLists nodes, optionally filtered by node type and scope.
Update flowsReplaces the complete deployed flow configuration.
Create nodeAdds a node definition to a flow tab.
Get nodeReturns one node definition by ID.
Update nodeMerges a patch into one node and redeploys it.

Get Flows and Get Nodes support:

  • All flows
  • Selected tab
  • Current tab, meaning the tab containing the Engine node

msg.scope overrides the configured scope. msg.flowId selects a tab when scope is tab.

FieldPurpose
msg.actionSelects the action in Auto mode.
msg.scopeOverrides flow or node-list scope.
msg.flowIdTab for selected-scope reads or Create Node.
msg.nodeTypeOptional Get Nodes filter.
msg.nodeIdTarget for Get Node or Update Node.
msg.payloadFlow array, new node definition, or node patch.
msg.regenerateIdsSet to "yes" when Update Flows should generate new IDs.

The current runtime evaluates msg.regenerateIds for Update Flows. Supply it explicitly when importing a template that must receive new IDs.

msg.payload must be a plain node-definition object. It must include type. The target tab can come from msg.payload.z, msg.flowId, or the configured Tab. An ID is generated when omitted.

msg.payload is merged into the target node. The runtime ignores structural changes to id and type, but other properties can change behavior, position, wiring-related configuration, or node-specific settings.

Update Flows replaces the complete flow configuration with the supplied array. An incomplete payload can remove unrelated tabs or nodes.

Use this action only with trusted, validated data and a recovery procedure. Do not expose Engine actions directly as unrestricted agent tools.

Invalid IDs, malformed payloads, and provider failures are passed to done(err). Attach a Catch node and record enough context to recover without logging sensitive flow credentials.