Skip to main content

Data Sources in Embedded Workflow Builder

In the low-code integration designer, data sources populate config wizard variables with dynamic data from third-party APIs. However, the embedded workflow builder doesn't have config wizards. Instead, you can use data sources to provide dynamic options directly for action inputs.

How data sources work in embedded workflow builder

In the embedded workflow builder, data sources provide picklist options for action inputs. When you reference a data source in an action input, the workflow builder fetches the data and displays it as a dropdown menu.

This allows your customers to select from dynamic lists like:

  • Slack channels from their workspace
  • Salesforce objects from their org
  • Users from their system
  • Any other data fetched from external APIs

Creating a data source for action inputs

To use a data source with an action input in the embedded workflow builder, you create both a data source and an action that references it.

Here's an example that fetches a list of people from an API and lets users select one:

index.ts
/**
* Main component file that exports the component definition.
* This file imports and combines the actions, data sources, and connections
* defined in separate files.
*/

import { component } from "@prismatic-io/spectral";
import { getPerson } from "./actions";
import { peopleApiKey } from "./connections";
import { selectPerson } from "./dataSources";

export default component({
key: "inlineDataSources",
public: false,
display: {
label: "inline-data-sources",
description: "Component demonstrating inline data sources for EWB",
iconPath: "icon.png",
},
// Export the action that uses the data source
actions: { getPerson },
// Export the data source so it can be referenced by actions
dataSources: { selectPerson },
// Export the connection for authenticating with the API
connections: [peopleApiKey],
});

Given the code above, a user configuring the Get Person action in the embedded workflow builder will see a dropdown menu for the Person ID input populated with names fetched from the API.

Embedded Workflow Builder Data Source Dropdown(maxWidth: 600px)

Key points

When creating data sources for the embedded workflow builder:

  1. Reference by key: In the action input, set dataSource to the key of your data source (in the example above, "selectPerson").
  2. Export the data source: Include the data source in your component's dataSources export.
  3. Use picklist type: The dataSourceType should be "picklist" for dropdown menus.
  4. Return key/label pairs: The data source should return an array of objects with key and label properties.

The embedded workflow builder will automatically fetch the data source when users configure the action and display the results as a dropdown menu.

Data source types in embedded workflow builder

Only picklist data source types work as action inputs in the embedded workflow builder

For complete information on creating data sources, see Config Wizard Data Sources.