Transform Node

Configure the Transform node to modify and reshape data as it flows through your workflow.

Overview

The Transform node modifies data as it passes through the workflow. Use it to reshape objects, extract fields, calculate values, or prepare data for downstream nodes.

Transform node configuration panel Transform node configuration panel

Configuration

To add a Transform node to your workflow:

  1. Click Add Node and select Transform
  2. Add one or more transformation steps
  3. Configure each step with JavaScript logic

Options

Transformation steps

Each step requires:

OptionDescription
NameA label for the transformation
DescriptionWhat the transformation does
JavaScript statementThe transformation logic

Click Add Step to add additional transformations to the same node.

Writing transformations

Transformations are JavaScript statements that modify the item object. Changes persist to downstream nodes.

Adding fields

item.processed_at = new Date().toISOString()

Extracting nested values

item.service_name = item.alert.labels.service

Calculating values

item.severity_numeric = { high: 3, medium: 2, low: 1 }[item.severity] || 0

String manipulation

item.short_message = item.message.substring(0, 100)
item.normalized_name = item.service.toLowerCase().replace(/\s+/g, '-')

Conditional assignment

item.priority = item.severity === 'critical' ? 'P1' : 'P2'

Array operations

item.tag_count = item.tags.length
item.first_tag = item.tags[0]

Object construction

item.summary = {
  title: item.alert.name,
  severity: item.severity,
  timestamp: item.created_at
}

Multiple steps

When you add multiple transformation steps, they execute in order. Each step can reference values set by previous steps.

Step 1:

item.severity_numeric = { critical: 4, high: 3, medium: 2, low: 1 }[item.severity]

Step 2:

item.is_urgent = item.severity_numeric >= 3

Best practices

Design effective transformations:

  • Keep steps focused: Each step should do one thing
  • Use descriptive names: Name steps to explain their purpose
  • Handle missing data: Check for undefined values before accessing nested properties
  • Validate types: Ensure data types match expected formats before transformation

Handling missing data

item.service = item.alert?.labels?.service || 'unknown'

Example patterns

Alert enrichment

Prepare alert data for notification:

StepJavaScript
Extract serviceitem.service = item.alert.labels.service
Format timestampitem.time = new Date(item.timestamp).toLocaleString()
Build titleitem.title = \[${item.severity.toUpperCase()}] ${item.alert.name}``

Data normalization

Standardize data from different sources:

StepJavaScript
Normalize severityitem.severity = item.priority ? { P1: 'critical', P2: 'high', P3: 'medium' }[item.priority] : item.severity
Extract environmentitem.env = item.tags.find(t => t.startsWith('env:')).split(':')[1]