Concepts
Transforms
Transforms allow you to manipulate data on the fly, which can be the event or attribute's payload, or the actual body that is transported to different destinations.
Anatomy of a transform#
An individual transform is based on the following properties:
type(required): the type of the transform (see below)- A source to transform (see sources page), with properties like:
sourceattributepayloadlookup
target: the target property to set/update the value invalue: the value to set/update the target property with
Types of transforms#
set#
If starting the transformation process with an empty object:
transforms: - type: set value: {}If setting in a specific target property:
transforms: - type: set target: myProperty # can be dot-separated path value: myValueHereIf getting value from a source and then setting it to a target property:
transforms: - type: set source: eventName target: eventremove#
Some properties may not be needed, and you can remove them:
transforms: - type: remove target: myProperty # can be dot-separated pathrename#
You can rename multiple properties at once:
transforms: - type: rename targetMap: existingProperty: newProperty # paths can be dot-separatedIf the renames need to be done in a sequential manner, you can make use of arrays in targetMap:
transforms: - type: rename targetMap: - existingProperty: newProperty - existingProperty2: newProperty2NOTE: This API may change in the future.
trim#
To trim whitespace from the beginning and end of a string value:
transforms: - type: trim target: myProperty # can be dot-separated pathtoInteger#
Convert a value to an integer:
transforms: - type: toInteger target: myProperty # can be dot-separated pathtoDouble#
Convert a value to a double (float):
transforms: - type: toDouble target: myProperty # can be dot-separated pathtoBoolean#
Convert a value to a boolean:
transforms: - type: toBoolean target: myProperty # can be dot-separated pathtoString#
Convert a value to a string:
transforms: - type: toString target: myProperty # can be dot-separated pathspread#
This is very useful if you would like to spread, let's say, the current attributes into the payload itself:
transforms: - type: spread source: attributesThis is JavaScript's equivalent of doing:
// sourcesconst attributes = { deviceId: "device-123", userId: "user-456" };const payload = { someProperty: "some value" };// transformsconst result = { ...payload, ...attributes };increment#
To increment a value by 1:
transforms: - type: increment target: myProperty # can be dot-separated pathTo increment a value by a specific amount:
transforms: - type: increment target: myProperty # can be dot-separated path value: 10decrement#
To decrement a value by 1:
transforms: - type: decrement target: myProperty # can be dot-separated pathTo decrement a value by a specific amount:
transforms: - type: decrement target: myProperty # can be dot-separated path value: 10concat#
@TODO
Conditions#
Each transform can also have its own set of conditions defined under the conditions property. If the conditions are met, the individual transform will then be applied.

