Skip to main content

set

Set, delete, or move message properties using configurable rules.

Overview

The set node modifies message properties through a list of configurable rules. Each rule can set a property to a new value, delete an existing property, or move a property from one location to another. Multiple rules execute in order, making it easy to reshape messages for downstream nodes without writing any code.

Set
Assign Values
Delete
Remove Props
Move
Reorganize
Rules
Sequential

Properties

Property Type Default Description
rules array [] Array of rule objects defining operations
rules[].type string "set" Operation type: "set", "delete", or "move"
rules[].property string "" Target property path (e.g., "payload.name")
rules[].to string "" Destination property path (for move operations)
rules[].value any "" Value to assign (for set operations)

Rule Types

set

Assign a value to a property. Creates nested paths automatically.

// Set msg.payload.status to "ok"
// Set msg.headers.auth to env var
// Set msg.timestamp to Date.now()

delete

Remove a property from the message entirely.

// Delete msg.payload.password
// Delete msg._internal
// Delete msg.debug

move

Move a property to a new location, removing the original.

// Move msg.data to msg.payload
// Move msg.temp to msg.sensors.temp
// Move msg.raw to msg._backup

Example: Rename Payload Fields for API Compatibility

Transform sensor data field names to match a third-party API schema.

// Set node configuration
{
  "rules": [
    // Rename "temp" to "temperature"
    { "type": "move", "property": "payload.temp", "to": "payload.temperature" },

    // Rename "hum" to "humidity"
    { "type": "move", "property": "payload.hum", "to": "payload.humidity" },

    // Rename "loc" to "location"
    { "type": "move", "property": "payload.loc", "to": "payload.location" },

    // Remove internal debug field
    { "type": "delete", "property": "payload._debug" },

    // Set API version header
    { "type": "set", "property": "headers.X-API-Version", "value": "2.1" }
  ]
}

// Input:  { temp: 22.5, hum: 65, loc: "Room A", _debug: true }
// Output: { temperature: 22.5, humidity: 65, location: "Room A" }

Example: Add Timestamp and Metadata to Messages

Enrich incoming messages with processing metadata before storing in a database.

// Set node configuration
{
  "rules": [
    // Add processing timestamp
    { "type": "set", "property": "payload.processedAt", "value": "$now()" },

    // Add device identifier from flow context
    { "type": "set", "property": "payload.deviceId", "value": "flow.deviceId" },

    // Add environment tag
    { "type": "set", "property": "payload.env", "value": "production" },

    // Add message version
    { "type": "set", "property": "payload.schemaVersion", "value": 3 },

    // Move raw data into nested object
    { "type": "move", "property": "payload.value", "to": "payload.data.reading" },

    // Delete sensitive source info
    { "type": "delete", "property": "payload.sourceIP" }
  ]
}

// Input:  { value: 42, sourceIP: "192.168.1.10" }
// Output: { data: { reading: 42 }, processedAt: "2025-...",
//          deviceId: "sensor-01", env: "production", schemaVersion: 3 }

Common Use Cases

API Schema Mapping

Rename and restructure fields to match external API requirements before sending requests.

Data Enrichment

Add timestamps, device IDs, version numbers, and context values to messages.

Security Sanitization

Delete passwords, API keys, tokens, and other sensitive fields before logging or forwarding.

Message Normalization

Standardize messages from different sources into a consistent format.

Related Nodes