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.
Syntax
Section titled “Syntax”Templates start with a dollar sign ($) followed by a bracketed key name.
| Bracket type | Source | Example |
|---|---|---|
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:
| Template | Replaced with |
|---|---|
$[*] | Full message payload as a JSON string |
${*} | Full message metadata as a JSON string |
Example
Section titled “Example”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=weather1Type Behavior
Section titled “Type Behavior”The following table shows what value is returned for each data type in the payload:
| Template | Payload value | Extracted result |
|---|---|---|
$[number] | 123.45 | 123.45 |
$[string] | "text" | text |
$[boolean] | true | true |
$[null] | null | null |
$[array] | [1, 2, 3] | $[array] (unchanged) |
$[object] | { "property": "val" } | $[object] (unchanged) |
$[object.property] | — nested access | val |
$[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.