Skip to main content

Helper actions

Helper actions are lightweight utility actions for connecting, transforming, and manipulating data between the larger actions in your flows. Use them to tasks such as parsing file paths, encoding URLs, extracting values from JSON objects, and building new data structures.

Helper actions do not consume Amplience Credits.

Tip

These action descriptions cover the most commonly used inputs and outputs. When designing flows, you may also notice additional input and output variables.

Set Custom Attributes
Link copied!

Allows you to add custom attributes for improved filtering and searching of review output.

Inputs: String

Outputs: None

How to use: Specify key-value attribute pairs in your flows - up to a maximum of 10 pairs per flow.

This example shows the Set Custom Attributes action being used to configure Image Type and SKU as custom filters. Once set, these filters appear automatically in the Flows Reviews list.

Workforce Flows editor showing a flow with the Set Custom Attributes action

Tip

The attribute Name is case-sensitive, so use consistent capitalization to avoid duplicate filters.

The Variable is determined by what you want to create filters for, and must be a string value. In this example, the Custom Agent output defines the imageType property values that will be used for filtering reviews:

Workforce Flows editor showing output of the Custom Agent action

This would show as an additional filter in the Reviews list filters:

Workforce Flow reviews list showing custom filters

Split File Name
Link copied!

Splits a file path into its parts: directory path, base name, and extension.

Inputs

InputTypeRequiredDescription
File PathstringYesThe file path or filename to extract parts from (e.g. documents/product-1.jpg)

Outputs

OutputTypeDescription
Base NamestringThe name of the file without its extension
ExtensionstringThe file extension (e.g. .pdf)
Directory PathstringThe directory path leading to the file (empty if none)

Featured in these example flows

Convert from JSON
Link copied!

Converts a JSON string into structured data (objects, arrays, numbers, or text) you can use in your flow.

Inputs

InputTypeRequiredDescription
JSON StringstringYesThe JSON text to decode (e.g. {"sku": "123456"})

Outputs

OutputTypeDescription
JSON ObjectanyThe result of decoding the JSON string. This may be an object, array, number, string, or boolean, depending on the input

Convert to JSON String
Link copied!

Transforms JSON data into a JSON string representation.

Inputs

InputTypeRequiredDescription
ObjectanyNoThe object to encode (e.g. { product: "shirt" })

Outputs

OutputTypeDescription
JSON StringstringThe result of transforming the object into a JSON string

Featured in these example flows

Get Values from JSON
Link copied!

Extracts specific fields or values from data using JSONPath expressions.

Configuration
Link copied!

Before using this action, define the values you want to extract. For each value, provide a name and a JSONPath expression that identifies the field to extract from the input data. Each configured value appears as a separate output on the action.

Inputs

InputTypeRequiredDescription
Values to ExtractanyNoThe data object or array to extract values from

Outputs

The output fields for this action are determined by the values you define in the action configuration. Each configured value appears as a separate output field using the name you provided.

Featured in these example flows

Build JSON object
Link copied!

Builds a JSON object from a set of properties you define when configuring the action.

Configuration
Link copied!

Before using this action, define the properties you want to include in the output object. Each property you add becomes an input field on the action, allowing you to populate it with a value or a variable from an earlier action in the flow.

Inputs

The input fields for this action are determined by the properties you define in the action configuration. Each configured property appears as a separate input field.

Outputs

OutputTypeDescription
JSON ObjectobjectA JSON object containing the properties and values provided as inputs

Transform JSON
Link copied!

Transforms input data using either a Handlebars template or a JSONata query.

Configuration
Link copied!

Before using this action, choose the transform language and provide the template or query to apply.

SettingDescription
Transform LanguageThe language to use for the transformation. Accepted values: Handlebars, JSONata (default)
TemplateA Handlebars template to apply to the input data. Only shown when Transform Language is set to Handlebars
QueryA JSONata query to apply to the input data. Only shown when Transform Language is set to JSONata

Inputs and outputs
Link copied!

Inputs

InputTypeRequiredDescription
DataanyNoThe JSON data to transform

Outputs

The output field depends on the transform language configured.

OutputTypeLanguageDescription
Output TextstringHandlebarsThe transformed output as a text string
Output DataanyJSONataThe transformed output as structured data
Combining inputs to Transform JSON

The Transform JSON helper accepts a single input. If you need to transform JSON data from multiple inputs, you can first combine them into a single object by using the Build JSON Object helper.

Example
Link copied!

Transform JSON allows you to take JSON input and transform it into the required structure. This is particularly useful when getting data from another system, in the form of a webhook payload, for example, and easily changing its structure to send to an action.

In the simplified example shown below, we're building a JSON object from user input, in this case two images, and then transforming it into an image format that can be passed to an action that accepts two images. To do this we're using a JSONata query to combine the two image objects onto a single array:

$each($, function($v) { $v })

In the configuration section of the action, set the Transform language, in this case JSONata, but you can also use handlebars.

The input is the JSON to process, in this example the output of the Build JSON object action.

Configuration and inputs for Transform JSON

Here's an example of the flow running. The output of the Build JSON action is shown, containing the images chosen by the user. But we need this data as an array of images, so we need to transform it.

The output of the Build JSON object

After running the Transform JSON action, the JSON is now has the correct structure to send as input to our action.

After running Transform JSON, the JSON now has the correct structure to pass to image actions

Encode URL
Link copied!

Encodes a string into a URL-safe format.

Inputs

InputTypeRequiredDescription
URLstringYesThe URL to encode

Outputs

OutputTypeDescription
Encoded URLstringThe result of encoding the URL

Decode URL
Link copied!

Decodes a URL-encoded string into plain text.

Inputs

InputTypeRequiredDescription
URLstringYesThe URL-encoded string to decode

Outputs

OutputTypeDescription
Decoded URLstringThe result of decoding the URL

Get Item from List
Link copied!

Identifies and extracts the value for the first, last, or nth item in a list.

Inputs

InputTypeRequiredDescription
ListarrayYesThe list of items to choose from
How to select the ItemstringYesWhether to return the first item, the last item, or an item at a specific position. Accepted values: first (default), last, index
PositionnumberNoThe position of the item to extract, starting at 0. Only required when How to select the Item is set to index

Outputs

OutputTypeDescription
ItemanyThe item found at the requested location

Adding actions to flows

Inputs, outputs and ports

Input field variables