Designing a Flow

Fastn’s visual canvas allows you to build workflows by dragging and connecting flow components. Each component represents a logic or data processing block.

At Fastn, flows are built using a set of core elements that define the structure and behavior of your automations. These include components such as the starting point of a flow, the steps it performs, how data moves between those steps, and how different services are connected.

Let’s dig into these components to see how they come together in a working flow.

Flow Elements in Fastn

These are the building blocks you’ll use to create automations in Fastn. Each element plays a specific role in making your flows powerful, flexible, and easy to maintain.

Connectors

Connectors link your flow to external services and APIs; like Slack, HubSpot, or Google Sheets, enabling seamless data exchange.

When you add a connector step, you’ll go through:

  • Select: Choose the group type (Fastn Connector or Custom Connector) → then select the app.

  • Endpoint: Pick the task you want to automate (e.g., sendMessage, getContacts).

  • Connect: Authenticate by connecting your account.

For example, for the Google Cloud Storage Connector, a selected endpoint can be createBucket.

  • Configure: Fill in the required fields or map from previous steps.

In this example,

Google Cloud Storage - Create Bucket

This connector action lets you create a new storage bucket in your Google Cloud project. You can map variables or outputs from previous steps into its configuration.

Params mapped in configuration

param.project      = {{var.googleProjectId}}
body.storageClass  = STANDARD
body.name          = {{var.bucketName}}
body.location      = US
  • param.project is mapped from a variable that holds your GCP project ID (googleProjectId).

  • body.name is dynamically mapped from a variable bucketName ; allowing each flow run to create a bucket with a unique name.

  • body.storageClass and body.location are fixed values here (STANDARD, US) but could also be mapped from variables or other steps.

The configuration parameters can be static values or mapped from previous steps as shown in this example.

Database

Use this to read from or write to Fastn’s internal database using SQL queries. Ideal for managing structured data inside your flows.

  • You can run queries to select, insert, or create tables.

  • Queries can also use outputs from earlier steps.

Example SQL Definition

Query = SELECT id, email FROM users WHERE active = True

Data Mapper

This lets you transform data between steps. You can map data from previous steps, variables, or secrets into a new object format you need later in the flow.

For example,

This example mapping step titled "Content" can be used when you need to map data (usually text) from a previous step and ensure it’s passed forward as a string.

Params mapped in configuration

res = steps.chatGPT.output.choices[0].message.content
  • Here, res is the variable inside the Content step.

  • It is mapped directly from the ChatGPT connector’s output: steps.chatGPT.output.choices[0].message.content.

  • The mapped value must always resolve to a string type, since Content steps are designed to pass textual data forward.

Example Usage

  • Pass the response from ChatGPT as plain text into another step (e.g., a database insert, a file generator, or a Slack notification).

To make this easier, the AI agent in the top-right corner offers smart suggestions for mapping your data. It helps you quickly pull values from previous steps or any flow data. You can simply drag and drop items like Headers, Inputs, Steps, Secrets, or App Config into the field you want to configure; making your mappings faster, more accurate, and less manual.

You can map values either in Json, Javascript, C#, Form or Python Lambda.

Example Json Mapping

{
  "json": {
    "res": "{{data.steps.chatGPT.output.choices[0].message.content}}"
  },
  "actions": {
    "json": {
      "action": [],
      "targetType": "object"
    },
    "json.res": {
      "action": [],
      "targetType": "object"
    }
  }
}

You can learn more about Data Mapping in Flows here.

Variables

Set and reuse values across your flow, like counters, strings, objects, or flags. Great for storing intermediate data or config settings.

Example Definition of Variable

Str filePath = "https://storage.fastn.ai/file.csv"  
Int retryCount = 2  
Boolean isSynced = False

Switch

Create conditional logic to control the flow of actions based on specific criteria. Switches let your automation choose different paths depending on conditions.

For example, "if your input equals a certain value, do action X; otherwise, do action Y." This makes your flows flexible and able to handle different situations automatically.

Case1: status = Str "shipped" → Action = NotifyCustomer  
Case2: status = Str "pending" → Action = SendReminder

You can add a number of cases and conditions as per your choice for the switch statement.

Loop

Repeat actions in a controlled way using the Loop flow component:

You can select the Loop Type and the Data you want to loop over, mapping it from previous flow steps.

  • Loop N times: Run a block a fixed number of times.

  • Loop over data: Iterate through each item in a list.

  • While loop: Keep looping as long as a condition is true.

Use End Loop to mark where the loop finishes.

In the example shown, the Loop Type is set to Loop over data and the Loop Data field is mapped from a previous step:

{{steps.sendMessage.output.message.blocks}}

This means the loop will go through each block inside the message output from the sendMessage step, allowing you to process every block one by one.

Download File

Fetch a file from a URL and use it within your flow.

For example, to parse a CSV or attach a file to an email.

SourceUrl = "https://files.server.com/report.csv"
DestinationName = monthlyReport
ContentType = text/csv

Logger

Add a step to log messages or data objects. Useful for debugging or tracking flow activity.

Header = Order Status Log  
Message = Order is confirmed

Converter

The Converter step transforms data into a different format (e.g., JSON → CSV, JSON → XML, JSON → Parquet). This is useful when preparing data for exports, analytics, or other APIs.

Example definition

StepName = convertInput  
ConversionType = JSON_PARQUET  
Source = {{input}}  
Settings = Default  

This means:

  • The step is named convertInput.

  • Input data ({{input}}) will be taken from the previous step.

  • Conversion type is set to JSON_PARQUET.

Custom Code

Write your own logic inside the flow using supported programming languages such as JavaScript, Python Lambda, or C#. This step is useful when you need more control, advanced data handling, or custom logic that cannot be achieved with standard components.

Example (C# Custom Code)

For example, if you need to add a Custom Code step in your flow, you can write a function that processes the data coming from previous steps and returns the output you want to use later. In the example below, the function is written in C#. It takes the flow data as input, extracts the steps object (which contains outputs from earlier steps), deserializes it into a dictionary, and then returns it. This allows you to handle the step data programmatically inside your flow and make it available for the next steps.

using System.Collections.Generic;
using System.Text.Json;

public static class FastnExecutor {
    public static object fastn_function(Dictionary<string, object> @params) {
        var data = (JsonElement)@params["data"];
        var dataJson = JsonSerializer.Deserialize<Dictionary<string, object>>(data.GetRawText());
        var steps = (JsonElement) dataJson["steps"];
        var stepsJson = JsonSerializer.Deserialize<Dictionary<string, object>>(steps.GetRawText());
        return steps;
    }
}

This example shows how you can configure the Custom Code step in C#, but the same component also works with JavaScript or Python Lambda, depending on your preference.

To make this easier, the AI agent in the top right corner provides smart suggestions about the code.

Flow Response: Success & Error

Control what gets returned when your flow ends. Customize success or error messages based on HTTP response codes.

Example Success Definition

Str Status = "success"  
Str Message = "Order processed"  
Int OrderId = 12345

Example Error Definition

Str Status = "error"  
Str ErrorMessage = "Invalid customer email"

Last updated

Was this helpful?