# Node-RED

> Work with Node-RED, the flow-based automation tool: call a flow's HTTP endpoint and use its answer, trigger an inject node, read context values, list, back up, add, enable, disable and delete flows, restart them, and check the server. Start a workflow when someone deploys flows.

App · 11 actions. Web page: https://docs.lodol.com/docs/integrations/node-red

## Actions

### Add flow

Add a flow to Node-RED from its export (Export in Node-RED's menu, or Get flow's) and deploy it, as a new tab with new node IDs.

**Inputs**

- Flow export (`flow_json`, text, required): The flow as JSON, as Node-RED's Export or Get flow gives it.
- Name (`label`, text): A name for the new flow. Leave blank for the export's own.
- Add it disabled (`disabled`, true/false): Add the flow switched off, to enable it later. Default: `false`.

**Outputs**

- `config_nodes_reused` (number): Configuration nodes in the export this Node-RED already had, used as they are
- `disabled` (true/false): True when it was added disabled
- `id` (text): The new flow's ID
- `label` (text): Its name
- `node_count` (number): How many nodes it has

**Example output**

```json
{
  "config_nodes_reused": 0,
  "disabled": false,
  "id": "6d5c4b3a29180f7e",
  "label": "Order checks (copy)",
  "node_count": 5
}
```

### Call flow endpoint

Send a request to a flow's own HTTP endpoint (an http in node) and get its answer, so a workflow can use logic built in Node-RED. Fails when the flow answers with an error status.

**Inputs**

- Endpoint (`path`, text, required): The URL set in the flow's http in node, such as /orders/check, optionally after its method: POST /orders/check.
- Method (`method`, text): The HTTP method. As the endpoint is set up uses the http in node's own. One of: `auto` (As the endpoint is set up), `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. Default: `auto`.
- Body (`body`, object): What to send, as JSON: names and values, such as order: A-1042. Text that isn't JSON is sent as text. The flow gets it in msg.payload.
- Query (`query`, object): Names and values to add to the address, such as id: 42. The flow gets them in msg.req.query.
- Headers (`headers`, object): Extra request headers, by name, such as X-Source: Lodol.
- Wait up to (seconds) (`timeout_seconds`, number): How long to wait for the flow to answer. Defaults to 60. From 1 to 300.

**Outputs**

- `body` (object): What the flow answered: read as JSON (an object, a list, a number) when it is JSON, otherwise the text
- `content_type` (text): The answer's content type, such as application/json
- `headers` (object): The answer's headers, by name
- `method` (text): The method the flow was called with, such as POST
- `ok` (true/false): True when the status is 2xx
- `status_code` (number): The HTTP status the flow answered with, such as 200
- `text` (text): What the flow answered, as text
- `url` (text): The address called

**Example output**

```json
{
  "body": {
    "in_stock": true,
    "order": "A-1042",
    "ship_by": "2026-11-12"
  },
  "content_type": "application/json; charset=utf-8",
  "headers": {
    "Content-Type": "application/json; charset=utf-8"
  },
  "method": "POST",
  "ok": true,
  "status_code": 200,
  "text": "{\"order\":\"A-1042\",\"in_stock\":true,\"ship_by\":\"2026-11-12\"}",
  "url": "https://nodered.example.com/orders/check"
}
```

### Delete flow

Delete a flow and its nodes from Node-RED and deploy. Nothing is deleted when it isn't there.

**Inputs**

- Flow (`flow`, text, required): The flow (a tab in the editor): its name or ID.

**Outputs**

- `deleted` (true/false): False when Node-RED had no such flow, so nothing was deleted
- `id` (text): The flow's ID
- `label` (text): Its name
- `node_count` (number): How many nodes were deleted with it

**Example output**

```json
{
  "deleted": true,
  "id": "6d5c4b3a29180f7e",
  "label": "Order checks (copy)",
  "node_count": 5
}
```

### Disable flow

Switch a flow off and deploy it, so its nodes stop running until it's enabled again.

**Inputs**

- Flow (`flow`, text, required): The flow (a tab in the editor): its name or ID.

**Outputs**

- `changed` (true/false): False when the flow was already as asked, so nothing was deployed
- `disabled` (true/false): True when the flow is disabled
- `endpoints` (list): The HTTP endpoints its http in nodes serve, such as POST /orders
- `id` (text): The flow's ID
- `info` (text): The flow's description
- `inject_nodes` (number): How many inject nodes it has
- `label` (text): The flow's name, as its tab shows it
- `node_count` (number): How many nodes it has

**Example output**

```json
{
  "changed": true,
  "disabled": true,
  "endpoints": [
    "POST /orders/check"
  ],
  "id": "4b1d7e2c9a8f0e36",
  "info": "Answers stock checks for the shop.",
  "inject_nodes": 1,
  "label": "Order checks",
  "node_count": 5
}
```

### Enable flow

Switch a disabled flow back on and deploy it, as the Disabled button in the flow's properties in the editor does.

**Inputs**

- Flow (`flow`, text, required): The flow (a tab in the editor): its name or ID.

**Outputs**

- `changed` (true/false): False when the flow was already as asked, so nothing was deployed
- `disabled` (true/false): True when the flow is disabled
- `endpoints` (list): The HTTP endpoints its http in nodes serve, such as POST /orders
- `id` (text): The flow's ID
- `info` (text): The flow's description
- `inject_nodes` (number): How many inject nodes it has
- `label` (text): The flow's name, as its tab shows it
- `node_count` (number): How many nodes it has

**Example output**

```json
{
  "changed": true,
  "disabled": false,
  "endpoints": [
    "POST /orders/check"
  ],
  "id": "4b1d7e2c9a8f0e36",
  "info": "Answers stock checks for the shop.",
  "inject_nodes": 1,
  "label": "Order checks",
  "node_count": 5
}
```

### Get context value

Read a value a flow keeps in Node-RED's context, such as a sensor reading or a counter, from global context or one flow's.

**Inputs**

- Name (`key`, text, required): The context variable's name, as the flow sets it, such as temperature.
- Scope (`scope`, text): Global context, shared by every flow, or one flow's context. One of: `global`, `flow`. Default: `global`.
- Flow (`flow`, text): The flow whose context to read, when the scope is Flow.
- Context store (`store`, text): The context store, such as file, when Node-RED has more than one. Leave blank for the default.

**Outputs**

- `exists` (true/false): False when the variable isn't set
- `flow` (text): The flow's name, for a flow's context
- `flow_id` (text): The flow's ID, for a flow's context
- `format` (text): What Node-RED says it is, such as number, Object or string[12]
- `key` (text): The context variable's name
- `scope` (text): global or flow
- `shortened` (true/false): True when Node-RED shortened the value, as it does past 1,000 characters or items
- `store` (text): The context store it was read from, such as memory
- `text` (text): The value as text (JSON for an object or list)
- `value` (object): The value: a number, text, true or false, an object or a list

**Example output**

```json
{
  "exists": true,
  "flow": "",
  "flow_id": "",
  "format": "number",
  "key": "boilerTemperature",
  "scope": "global",
  "shortened": false,
  "store": "memory",
  "text": "61.5",
  "value": 61.5
}
```

### Get flow

Get one flow with its nodes, and its export as JSON: keep it as a backup, or add it to another Node-RED with Add flow.

**Inputs**

- Flow (`flow`, text, required): The flow (a tab in the editor): its name or ID.

**Outputs**

- `config_nodes` (list): Configuration nodes shared by every flow that the flow's nodes use, such as an MQTT broker
- `disabled` (true/false): True when the flow is disabled
- `endpoints` (list): The HTTP endpoints its http in nodes serve, such as POST /orders
- `export` (text): The flow as JSON, as Node-RED's Export makes it: keep it as a backup, import it in the editor, or add it again with Add flow
- `id` (text): The flow's ID
- `info` (text): The flow's description
- `inject_nodes` (number): How many inject nodes it has
- `label` (text): The flow's name, as its tab shows it
- `node_count` (number): How many nodes it has
- `nodes` (list): The flow's nodes, as Node-RED stores them: each with its id, type, name and settings

**Example output**

```json
{
  "config_nodes": [],
  "disabled": false,
  "endpoints": [
    "POST /orders/check"
  ],
  "export": "[{\"id\": \"4b1d7e2c9a8f0e36\", \"type\": \"tab\", \"label\": \"Order checks\"}]",
  "id": "4b1d7e2c9a8f0e36",
  "info": "Answers stock checks for the shop.",
  "inject_nodes": 1,
  "label": "Order checks",
  "node_count": 5,
  "nodes": [
    {
      "id": "1a2b3c4d5e6f7081",
      "method": "post",
      "name": "",
      "type": "http in",
      "url": "/orders/check",
      "wires": [
        [
          "2b3c4d5e6f708192"
        ]
      ],
      "z": "4b1d7e2c9a8f0e36"
    }
  ]
}
```

### Get server info

Get Node-RED's version, the Node.js it runs on, its memory use and the node modules installed, such as for a weekly check.

**Inputs**: None.

**Outputs**

- `containerised` (true/false): True when it runs in a container, such as Docker
- `context_stores` (list): Its context stores, such as memory or file
- `flow_count` (number): How many flows it has
- `flows_running` (true/false): True while Node-RED's flows are started
- `http_node_root` (text): Where the flows' HTTP endpoints start, such as /
- `memory_mb` (number): Memory Node-RED uses, in MB; 0 when it doesn't say
- `module_count` (number): How many node modules are installed
- `modules` (list): The node modules installed, Node-RED's own first
- `node_js_version` (text): The Node.js version it runs on, such as v22.11.0
- `permissions` (text): What that user may do: * for everything, read to only read
- `platform` (text): The operating system, such as linux
- `user` (text): The Node-RED user the connection signs in as; empty with no sign-in
- `version` (text): Node-RED's version, such as 4.1.2

**Example output**

```json
{
  "containerised": true,
  "context_stores": [
    "memory"
  ],
  "flow_count": 3,
  "flows_running": true,
  "http_node_root": "/",
  "memory_mb": 112.4,
  "module_count": 2,
  "modules": [
    {
      "enabled": true,
      "module": "node-red",
      "node_types": 41,
      "version": "4.1.2"
    },
    {
      "enabled": true,
      "module": "node-red-contrib-home-assistant-websocket",
      "node_types": 23,
      "version": "0.77.1"
    }
  ],
  "node_js_version": "v22.11.0",
  "permissions": "*",
  "platform": "linux",
  "user": "admin",
  "version": "4.1.2"
}
```

### List flows

List Node-RED's flows (the editor's tabs), with how many nodes each has, its HTTP endpoints and whether it's enabled; optionally with every flow exported as JSON, for a backup.

**Inputs**

- Enabled or disabled (`state`, text): Only enabled flows, or only disabled ones. One of: `any`, `enabled`, `disabled`. Default: `any`.
- Include export (`include_export`, true/false): Also return every flow, subflow and configuration node as JSON, as Node-RED's Export makes it, such as to save a backup. Default: `false`.

**Outputs**

- `count` (number): How many flows are listed
- `disabled_count` (number): How many of them are disabled
- `enabled_count` (number): How many of them are enabled
- `export` (text): Every flow, subflow and configuration node as JSON, as Node-RED's Export makes it, when asked for; empty otherwise
- `flows` (list): The flows (tabs), in the editor's order
- `rev` (text): The current deploy's revision; it changes at every deploy
- `subflow_count` (number): How many subflows Node-RED has

**Example output**

```json
{
  "count": 2,
  "disabled_count": 1,
  "enabled_count": 1,
  "export": "",
  "flows": [
    {
      "disabled": false,
      "endpoints": [
        "POST /orders/check"
      ],
      "id": "4b1d7e2c9a8f0e36",
      "info": "Answers stock checks for the shop.",
      "inject_nodes": 1,
      "label": "Order checks",
      "node_count": 5
    },
    {
      "disabled": true,
      "endpoints": [],
      "id": "9e0a4c7d2b1f8e53",
      "info": "",
      "inject_nodes": 1,
      "label": "Old heating schedule",
      "node_count": 2
    }
  ],
  "rev": "52f63b979e660e1930061fcbb35348a3",
  "subflow_count": 0
}
```

### Restart flows

Stop and start every flow, as Node-RED's Deploy > Restart Flows does, such as after a device reconnects.

**Inputs**: None.

**Outputs**

- `flow_count` (number): How many flows Node-RED has
- `restarted` (true/false): True once Node-RED restarted its flows
- `restarted_at` (text): When they were restarted (ISO 8601, UTC)
- `rev` (text): The deploy's revision

**Example output**

```json
{
  "flow_count": 3,
  "restarted": true,
  "restarted_at": "2026-11-09T07:00:00Z",
  "rev": "41697916d6ae1a4a1cc3e4c7ac80bcb2"
}
```

### Trigger inject node

Run a flow from one of its inject nodes, as clicking its button in the editor does, with its own payload or one you give.

**Inputs**

- Inject node (`inject_node`, text, required): The inject node: its name or ID.
- Payload (`payload`, text): A payload to send instead of the node's own: text, or JSON such as {"room": "office"}. Leave blank for the node's own.

**Outputs**

- `flow` (text): The name of the flow it's in
- `flow_id` (text): The ID of the flow it's in
- `name` (text): The inject node's name
- `node_id` (text): The inject node's ID
- `payload_given` (true/false): True when the step sent a payload of its own
- `triggered` (true/false): True once Node-RED took the trigger
- `triggered_at` (text): When it was triggered (ISO 8601, UTC)

**Example output**

```json
{
  "flow": "Nightly backup",
  "flow_id": "4b1d7e2c9a8f0e36",
  "name": "Run backup",
  "node_id": "8f3c2a1b9d0e4f57",
  "payload_given": false,
  "triggered": true,
  "triggered_at": "2026-11-09T07:00:00Z"
}
```
