Components

Overview

A component is a portion of reusable code that accomplishes a specific task, or connects with an outside service. For example, the SFTP component allows integrations to download and modify files on an SFTP server. The Slack component posts messages to Slack channels.

Several components are strung together to form an integration. A very simple integration might use the AWS S3 component to pull down a file from S3, and post the contents of the file to a Slack channel using the Slack component.

Complex integrations might be comprised of dozens of actions.

Prismatic-Provided Components

Prismatic offers a wide array of components to accomplish a variety of things, like serializing data formats, invoking REST endpoints, or interacting with commonly-used SaaS platforms like AWS, Slack, or Dropbox - see our component catalog for a full list of components. Source code for some Prismatic-provided components is available on GitHub.

You can read about components within the web app by clicking the Components link on the left-hand sidebar. For more detail about a particular component, click the Component > link of the component you want to know more about.

Custom Components

The majority of your integration can likely be developed using Prismatic-provided components. For the portions of your integrations that are specific to your industry or product, Prismatic provides the ability to run custom code as part of your integration. You can deploy your own code in the form of reusable custom components or short code component steps.

For More Information: When Should I Use a Custom Component vs a Code Component?

Component Actions

Components contain one or more actions that can be invoked. For example, the AWS S3 component contains actions to copy S3 objects, delete objects, get an object's contents, etc.

You can view the actions of a component by clicking Components on the left-hand sidebar of the web app, and then clicking into a component. You will see the actions a component contains, required credentials to execute those actions, and inputs the actions take.

For More Information: Custom Component Actions

Component Authorization Methods

Some components require credentials to interact with a SaaS provider, REST endpoint, etc. Those credentials might be username/password sets, API keys, OAuth2 tokens, etc.

To see what authorization methods a component can use, click the Components link on the left-hand sidebar and select a component. Authorization methods will be listed in the component description page.

For More Information: Authorization Credentials, Credentials in an Integration

Component Action Inputs

Component actions take inputs, and execute on those inputs accordingly. Inputs might include a RESTful URL endpoint, an S3 bucket name, or a Slack webhook to invoke. Inputs can be static strings (perhaps a URL for a HTTP request), or can be a variable based on a config variable or output of a previous action.

JSONata Input Mode

Prismatic uses JSONata for inputs and outputs. To reference a config var use configVars.VARIABLE_NAME. To reference an output from a previous action use outputs.STEP_NAME.OUTPUT_NAME.

If, for example, you have a configuration variable named myApiUrl equal to http://some-api.com/, and you would like to generate a URL of the form https://some-api.com/some/rest/endpoint, you can enter configVars.myApiUrl & 'some/rest/endpoint' when in JSONata mode.

You can use JSONata functions within your input. For example, if a previous step named get_todo_items output an array named todos, like in the getting started example, you could generate a string as input reading "You have " & $count(outputs.get_todo_items.todos) & " tasks to complete.".

Simple Input Mode

In addition to JSONata mode, the web app provides an input mode called simple mode. To switch to simple mode, click the icon once. You can enter strings, or call up a variable helper screen by typing an = sign. Once you tap = you will be presented a dialogue that auto-fills possible configVars and output values. Once you are satisfied with your input, you can optionally click the icon again to translate your simple mode input back to JSONata mode.

For More Information: Custom Component Inputs, Integration Designer

Component Action Outputs

Some component actions return results that can be read in as inputs in subsequent steps. That output can be referenced by referencing the outputs.STEP_NAME.OUTPUT_NAME variable in an input field.

Component Action Output Example

For example, if you configure an HTTP GET step to pull "TODO" items from https://jsonplaceholder.typicode.com/todos, the JSON returned is accessible in subsequent steps.

You could select a random "TODO" item and send its title as a Slack message using the JSONata $shuffle() function. To do that, reference outputs.httpget.all.

Reusable Output Expressions

In the previous example the output of an HTTP GET action was mutated as input for a subsequent Slack step. What would happen, though, if you needed that same TODO item title in multiple steps? You could enter the expression $shuffle(outputs.httpget.all)[0].title for the input of each step, but that would select a different random TODO item each time. Instead, we want to select a TODO item title, and use that same title throughout.

You can create a named output on the HTTP GET step, and reference that output in multiple subsequent steps. In this example we save $shuffle(outputs.httpget.all)[0].title to an output named randomTodoTitle, and reference outputs.httpget.randomTodoTitle in a subsequent step.

Like input, output can be formatted using JSONata syntax, or be strung together in simple mode (described in inputs above)

Last updated on