or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

common-nodes.mdfunction-nodes.mdindex.mdnetwork-nodes.mdparser-nodes.mdsequence-nodes.mdstorage-nodes.md

common-nodes.mddocs/

0

# Common Nodes

1

2

Common nodes provide essential flow control, debugging, and basic automation capabilities that form the foundation of most Node-RED flows.

3

4

## Capabilities

5

6

### Inject Node

7

8

Manual and scheduled message injection for triggering flows. Supports one-time manual triggers, interval-based scheduling, and cron-style timing.

9

10

```javascript { .api }

11

/**

12

* Inject node for manual and scheduled message injection

13

* Registers as node type: "inject"

14

*/

15

function InjectNode(config) {

16

RED.nodes.createNode(this, config);

17

18

// Configuration properties:

19

// config.payload - Message payload to inject

20

// config.payloadType - Type of payload (str, num, bool, json, date, etc.)

21

// config.topic - Message topic

22

// config.repeat - Repeat interval in seconds

23

// config.crontab - Cron expression for scheduling

24

// config.once - Fire once on startup

25

}

26

27

// HTTP endpoint for remote triggering

28

// POST /inject/:id - Trigger specific inject node

29

```

30

31

**Usage Examples:**

32

33

```javascript

34

// Inject configuration for scheduled trigger

35

{

36

"id": "inject1",

37

"type": "inject",

38

"payload": "hello world",

39

"payloadType": "str",

40

"topic": "test",

41

"repeat": "5", // Every 5 seconds

42

"once": true // Fire on startup

43

}

44

45

// Inject with cron schedule

46

{

47

"id": "inject2",

48

"type": "inject",

49

"payload": "",

50

"payloadType": "date",

51

"crontab": "0 9 * * 1-5" // 9 AM, Monday-Friday

52

}

53

```

54

55

### Debug Node

56

57

Output messages to the debug sidebar and console for flow debugging and monitoring. Supports complete message display or specific property output.

58

59

```javascript { .api }

60

/**

61

* Debug node for message output and monitoring

62

* Registers as node type: "debug"

63

*/

64

function DebugNode(config) {

65

RED.nodes.createNode(this, config);

66

67

// Configuration properties:

68

// config.console - Output to console (true/false)

69

// config.complete - Complete message or property name

70

// config.targetType - Type of target (msg, full)

71

// config.active - Debug active state

72

}

73

74

// HTTP endpoints for debug control

75

// POST /debug/:state - Control all debug nodes (true/false)

76

// POST /debug/:id/:state - Control specific debug node

77

// GET /debug/view/view.html - Debug viewer HTML interface

78

```

79

80

### Complete Node

81

82

Trigger when specified nodes complete their processing. Used for flow synchronization and completion detection.

83

84

```javascript { .api }

85

/**

86

* Complete node for detecting node completion

87

* Registers as node type: "complete"

88

*/

89

function CompleteNode(config) {

90

RED.nodes.createNode(this, config);

91

92

// Configuration properties:

93

// config.scope - Array of node IDs to monitor

94

// config.uncaught - Monitor all uncaught completions

95

}

96

```

97

98

### Catch Node

99

100

Error handling for flows, catching errors from specified nodes or globally. Essential for robust flow design.

101

102

```javascript { .api }

103

/**

104

* Catch node for error handling in flows

105

* Registers as node type: "catch"

106

*/

107

function CatchNode(config) {

108

RED.nodes.createNode(this, config);

109

110

// Configuration properties:

111

// config.scope - Array of node IDs to catch errors from

112

// config.uncaught - Catch all uncaught errors

113

}

114

```

115

116

**Usage Examples:**

117

118

```javascript

119

// Catch errors from specific nodes

120

{

121

"id": "catch1",

122

"type": "catch",

123

"scope": ["function1", "http-request1"],

124

"uncaught": false

125

}

126

127

// Global error catcher

128

{

129

"id": "catch-all",

130

"type": "catch",

131

"scope": [],

132

"uncaught": true

133

}

134

```

135

136

### Status Node

137

138

React to node status changes, monitoring the operational state of other nodes in the flow.

139

140

```javascript { .api }

141

/**

142

* Status node for monitoring node status changes

143

* Registers as node type: "status"

144

*/

145

function StatusNode(config) {

146

RED.nodes.createNode(this, config);

147

148

// Configuration properties:

149

// config.scope - Array of node IDs to monitor status from

150

}

151

```

152

153

### Link Nodes

154

155

Create virtual connections between flows using link-in and link-out nodes. Enables flow organization and reusability.

156

157

```javascript { .api }

158

/**

159

* Link In node - virtual input connection point

160

* Registers as node type: "link in"

161

*/

162

function LinkInNode(config) {

163

RED.nodes.createNode(this, config);

164

165

// Configuration properties:

166

// config.links - Array of link-out node IDs that connect to this

167

}

168

169

/**

170

* Link Out node - virtual output connection point

171

* Registers as node type: "link out"

172

*/

173

function LinkOutNode(config) {

174

RED.nodes.createNode(this, config);

175

176

// Configuration properties:

177

// config.links - Array of link-in node IDs to send to

178

// config.mode - "link" or "return" mode

179

}

180

```

181

182

**Usage Examples:**

183

184

```javascript

185

// Link out configuration

186

{

187

"id": "linkout1",

188

"type": "link out",

189

"links": ["linkin1", "linkin2"],

190

"mode": "link"

191

}

192

193

// Link in configuration

194

{

195

"id": "linkin1",

196

"type": "link in",

197

"links": ["linkout1"]

198

}

199

```

200

201

### Comment Node

202

203

Documentation and annotation within flows. Provides no functional behavior but improves flow readability.

204

205

```javascript { .api }

206

/**

207

* Comment node for flow documentation

208

* Registers as node type: "comment"

209

*/

210

function CommentNode(config) {

211

RED.nodes.createNode(this, config);

212

213

// Configuration properties:

214

// config.info - Comment text content

215

}

216

```

217

218

### Unknown Node

219

220

Placeholder for missing or unrecognized node types. Maintains flow integrity when nodes are unavailable.

221

222

```javascript { .api }

223

/**

224

* Unknown node - placeholder for missing node types

225

* Registers as node type: "unknown"

226

*/

227

function UnknownNode(config) {

228

RED.nodes.createNode(this, config);

229

230

// Preserves original node configuration for when proper node becomes available

231

}

232

```

233

234

## Message Flow Patterns

235

236

Common nodes typically handle standard Node-RED messages:

237

238

```javascript { .api }

239

// Input message handler pattern

240

this.on("input", function(msg, send, done) {

241

try {

242

// Process message

243

msg.payload = processedData;

244

245

// Send to next nodes

246

send(msg);

247

248

// Signal completion

249

done();

250

} catch (error) {

251

// Signal error

252

done(error);

253

}

254

});

255

```

256

257

## Configuration Examples

258

259

```javascript

260

// Complete flow control setup

261

{

262

"inject": {

263

"payload": "start process",

264

"repeat": "10"

265

},

266

"debug": {

267

"complete": "payload",

268

"console": true

269

},

270

"catch": {

271

"scope": ["process-node"],

272

"uncaught": false

273

},

274

"complete": {

275

"scope": ["process-node"]

276

}

277

}

278

```