How data transform works
The Data Transform node generates or modifies variables in your trigger data, which are then merged into the main payload used by the workflow and templates to render dynamic content. You can write these transformations using Handlebars or JSONNET language. We use a shallow merge strategy where keys with the same name as the input payload will be overridden. Example: Given the following trigger data for two users:
Modifying list of variables in data transform
You can generate up to 25 variables in this step. Each key-value pair represents a variable and its value. You can choose to write transformation in Handlebars or JSONNET language. Handlebar is a simpler language suitable for simple string outputs, while JSONNET can handle more complex data structures such as arrays or JSON objects.Some common notification use cases
-
Use
$batched_variables
or Handlebar helpers in SMS and WhatsApp templates where approval is required. Since these templates are pre-approved, the type of variable content can’t be changed dynamically for these templates, limiting the use of handlebars helpers in these templates. You can use data transform node to write transformation outside template editor and pass the generated variable in template. - Generating variables for use in workflow settings. e.g., dynamically manage user preferences for notifications within a workflow. For instance, if users have different digest preference on channels and want to receive digest notifications on some channels and immediate alerts on others, you can create an array of channels for each type of notification. This array can then be used in the override channel settings of the multi-channel delivery node to handle both digest and immediate alerts appropriately.
- Fetch Response Modification: Adjust the structure of responses from fetch operations as needed.
- Apply batching conditions where some users receive batched notifications and others get immediate alerts. Use the Data Transform node to ensure a consistent data structure in both cases for use in templates.