Skip to main content

Passing Data Between Steps

Step outputs

When a step runs, it optionally outputs data that can be used as input for subsequent steps. For example, an SFTP List Files step will output an array of file names:

Example of step outputs as a list in Prismatic app

An SFTP Get File step will output the contents of a file that it fetched from an SFTP server (in this case, an image):

Example of step outputs as a file in Prismatic app

Outputs take one of three forms:

  • A primitive value, like a string, boolean value, number, or array of primitives. A subsequent step that references this output will receive the string, boolean, number, or array as input.

  • An object. An output might include multiple key-value pairs:

    { "key1": "value1", "key2": ["value2.0", "value2.1", "value2.2"] }

    You might see this after pulling JSON from an HTTP endpoint. Specific values from an object can be referenced as inputs using familiar JavaScript .dot and ["bracket"] notation. Using the above as an example, if you wanted to access value2.1 you could reference results.key2[1].

  • A binary file. Binary file outputs contain a combination of a file Buffer and in indicator of content type (like "image/png") in the form:

    {
    "data": Buffer,
    "contentType": String
    }

Note: an action can return a combination of JSON and binary file(s) if properties of the JSON object are objects with data and contentType properties.

For More Information: Custom Component Action Results

Configuring step inputs

Once you have added a step to your integration, you will likely need to configure some inputs for that step. Inputs might include a RESTful URL endpoint, an S3 bucket name, a Slack webhook to invoke, or even a binary file like an image or PDF to upload or process.

Some inputs are required, and denoted with a * symbol, while others are optional.

Inputs can take one of four forms: value, reference, config variable or template. Value inputs are static strings, reference inputs reference the results of a previous step, config variable inputs reference a customer-specific config variable, and template inputs allow you to concatenate static strings, config variables, and step result references.

use the Join Lines action for multi-line input values

If you need to enter multiple lines of text for an input value, you can use the Join Lines action to concatenate multiple lines of text into a single string.

Join lines action in an input

Value inputs

A value is a simple string (perhaps a URL for an HTTP request). If you set a value for an input, that static value will be used as an input for all of your customers:

Set input value in Prismatic app

Reference inputs

A reference is a reference to the output of a previous step. For example, if a previous step pulls down a file from Amazon S3 and the step is named Fetch my file, then you can reference Fetch my file as in input for another step, and that subsequent step will be passed the file that Fetch my file returned.

Outputs from one step can be referenced by a subsequent step by referencing the previous step's results field. So, if a previous step returned an object - for example, if an HTTP - GET action pulled down some JSON reading { "firstKey": "firstvalue", "secondKey": "secondvalue" } - you access that firstvalue property in a subsequent step's input by selecting the HTTP - GET step and choosing results.firstKey in your Reference search:

Reference earlier step result as step input in Prismatic app

Config variable inputs

A config variable references one of the integration's config variables. For example, we can select a config variable, CMS API Endpoint, as an input for one of our steps. Config variables can be distinct for each customer, so each customer can be configured with a different CMS API Endpoint:

Config variable inputs in Prismatic app

Template inputs

Finally, a template is a combination of string values, config variables or step result references. You can concatenate several strings, config variables, and step results together to serve as a single input.

Templates are useful if an input needs to be templated out from various config variables and step results. For example, suppose you want to make an HTTP request to an API Endpoint that is stored as a config variable, and fetch an item whose ID was fetched in a previous step. You could combine the API endpoint, URL path, and product ID like this:

Add template input in Prismatic app

A static string, like /product?id= can be intermixed with config variables and step result references.

You can add references to config variables or step results by clicking the + button.

Template inputs in Prismatic app

For More Information: Custom Component Inputs