Overview

The Flow Input Block is a crucial component for creating dynamic and reusable flows. It allows you to define inputs that can be passed into your flow when it’s called via the SDK or used as a subflow. This flexibility enables you to create versatile workflows that can adapt to different scenarios based on the input provided.

Inputs

default
any

The default value for the input if no value is provided when the flow is called. Only available if the Use Default Value Input setting is enabled.

Outputs

data
any

The value of the input. This will be the value provided when the flow is called, or the default value if no value is provided. The data type matches the type specified in the Editor Settings.

Editor Settings

id
string
required

The unique identifier for the input. This ID is used when calling the flow and defines the input’s name in the UI.

dataType
string
default:"string"

Specifies the expected data type for the input.

defaultValue
any

The default value used when no input is provided during flow execution.

useDefaultValueInput
boolean
default:false

When enabled, allows the default value to be provided via an input port.

editor
string
default:"auto"

The editor to use when editing this value in the UI. Make sure this matches the data type. Options:

  • none: No editor
  • auto: Automatically select editor based on data type
  • string: String editor
  • number: Number editor
  • code: Code editor
  • dataTypeSelector: Data type selector
  • stringList: String list editor
  • keyValuePair: Key-value pair editor
  • toggle: Toggle switch editor

Examples

Basic Input Definition

  1. Add a Flow Input Block to your flow
  2. Set the ID to username and the Data Type to string
  3. Set a Default Value of "Guest"

Now, your flow has an input named username that defaults to “Guest” if no value is provided.

Using Flow Input in a Subflow

  1. Create a new flow with a Flow Input Block
  2. Set the ID to temperature and the Data Type to number
  3. Add a Conditional Block that checks if the temperature is above 30°C
  4. Save this flow and return to your main flow
  5. Add a Subflow Block and select the flow you just created
  6. The Subflow Block will now have an input port for temperature

This example creates a reusable subflow that can perform actions based on a temperature input.

Error Handling

The Flow Input Block will throw an error if:

  • The provided input value cannot be coerced into the specified data type
  • A required input is not provided and has no default value
  • For array data types, undefined inputs will be converted to empty arrays

Always ensure that your input values match the expected data types to avoid runtime errors.

Best Practices

  • Use descriptive IDs for your inputs to make your flows more readable
  • Set appropriate default values to handle cases where inputs aren’t provided
  • Consider using the Use Default Value Input setting for more dynamic default values
  • Choose an appropriate editor type that matches your data type

Further Reading