Overview

A Mapping will translate an input key and value into an output key and value according to the key configuration and Mapping Type that has been selected within your event mapping. Output keys and values are typically transformed to meet destination API requirements, while customizations may also be made depending on your requirements.

Key Benefits

  • Provides most necessary functions to transform an existing event payload into a format that is acceptable by a destination’s API.
  • All functions are point-and-click and do not require knowledge of Lua.

Transforming Input Keys

Transforming input keys is simple. Within a playbook, choose the “Mapping” Transform. This will make the input key and output key available to edit. Rename the output key to whatever you’d like- typically this key would be expected by the destination API.

Setting Default Values

If no value is sent with a key, you have the option to add a default value that MetaRouter will set. You can set the data type and value for the default value by toggling the Set a default value for this key? option.

Available Value Transformations

MetaRouter provides many transformation types that will alter the value associated with an input key.

💡

Programmatic transformation (wildcard matches, regular expressions) can be performed using Expressions.

Direct Assign

A Direct Assign mapping will not apply any transformation on the input key or value. The input value will be sent to the destination API exactly as we receive it

Input ValueOutput Value
“3c4f4623023c3e89dcbd53fd9b24aa58”“3c4f4623023c3e89dcbd53fd9b24aa58”

Join Values

Joins a list of values using the separator to a single string value.

SeparatorInput ValueOutput Value
,[”games”, “fun”, “play”]“games, fun,play”

Lowercase String

A Lowercase String mapping will transform any uppercase letters within the value to lowercase, and then ensure the data type is a String.

Input ValueOutput Value
TR1234567890“tr1234567890”

Pluck Values

Extracts the value of a given property from an array of objects returning a list.

Extract KeyInput ValueOutput Value
foo[{”foo”: 1, “bar”: 9}, {”foo”: 2, “bar”: 8}, {”foo”: 3 }][1,2,3]

Replace String

The Replace String mapping will transform a value to a string if the value is not a string already. The mapping requires two fields to be entered:

  • Replace. The mapping will look for exact matches of the value entered in the Replace field.
  • With. Where an exact match of the “Replace” value is found, that value will be replaced with the value entered in the With field.
ReplaceWithInput ValueOutput Value
,/"games, fun, play, entertainment”"games/ fun/ play/ entertainment”

The Replace String mapping does not support wildcard matching or contextual replacement

Split String

A Split String mapping will transform the input value into a string if not a string already, then will split it via the specified Separator into an Array. The resulted output value will be an Array with the maximum elements number based on the specified Max Elements.

SeparatorMax ElementsInput ValueOutput Value
,3"games,fun,play,entertainment”[

"games",
"fun",
"play"
] |

Note how the “entertainment” text is left off, as it was the fourth item in the string and we only allowed a Max Elements of three.

Substring

A Substring mapping will transform the input value into a string if not a string already, then will grab the subset of the characters given the Start and End character positions.

StartEndInput ValueOutput Value
0212345"12”

To Boolean

A To Boolean mapping will transform the input value into a boolean.

To Float

A To Float mapping will transform the input value into a float.

To Hash

A To Hash mapping will transform the input value by applying a Hash function on it.

Available Hash functions:

  • MD5
  • SHA256

The resulting data type is a string.

To Rounded Integer

A To Rounded Integer mapping will transform the input value into a float, then will round it into the nearest whole integer.

Input ValueOutput Value
28.7529

To String

A To String mapping will transform the input value into a string.

To Truncated Integer

A Truncated Integer mapping will transform the input value into a float, and then will truncate it into an integer. This will remove decimals if any exist.

Input ValueOutput Value
“27.5”27

Trim String

A Trim String mapping will transform the input value into a string, and then will trim all leading and trailing whitespace characters including newlines and carriage returns.

Input ValueOutput Value
“ TR1234567890 “"TR1234567890”

Truncate Float

A Truncate Float mapping will transform the input value into a float, and then will truncate it into an integer based on the provided precision value.

PrecisionInput ValueOutput Value
31.22341.223

Uppercase String

An Uppercase String mapping will transform the input value into a string, and then will convert the entire string to uppercase letters.

Input ValueOutput Value
tr1234567890“TR1234567890”