Skip to content
Stand with Ukraine flag

Templatization

Templatization lets you embed dynamic placeholders in rule node configuration fields so that actual values are substituted from the incoming message at runtime. Instead of hardcoding a device name or location, you write a template like ${deviceName} and the rule engine fills it in when the message is processed.

Templates start with a dollar sign ($) followed by a bracketed key name.

Bracket typeSourceExample
Square $[key]Message payload$[temperature]
Curly ${key}Message metadata${deviceName}

Dot notation accesses nested payload keys: $[object.property].

Two wildcard templates serialize the entire payload or metadata as a JSON string:

TemplateReplaced with
$[*]Full message payload as a JSON string
${*}Full message metadata as a JSON string

Given this incoming message:

Payload

{
"temperature": 26.5,
"humidity": 75.2,
"windSpeed": 26.2,
"location": "riverside"
}

Metadata

{
"deviceType": "weather_sensor",
"deviceName": "weather1",
"ts": "1685379440000"
}

A REST API URL template in a rule node:

example-base-url.com/report-reading?location=$[location]&deviceName=${deviceName}

Resolves at runtime to:

example-base-url.com/report-reading?location=riverside&deviceName=weather1

The following table shows what value is returned for each data type in the payload:

TemplatePayload valueExtracted result
$[number]123.45123.45
$[string]"text"text
$[boolean]truetrue
$[null]nullnull
$[array][1, 2, 3]$[array] (unchanged)
$[object]{ "property": "val" }$[object] (unchanged)
$[object.property]— nested accessval
$[doesNotExist](key absent)$[doesNotExist] (unchanged)
  • Templates can be mixed with plain text: "Fuel tanks are filled to $[fuelLevel]%".
  • The $[*] wildcard includes all payload fields as a compact JSON string, for example: "Raw data: $[*]""Raw data: {"mode":"eco","targetTemp":21,"active":true}".
  • The ${*} wildcard does the same for metadata.