Flows
Overview
In the fastn platform, flows are sequences of steps that perform an end-to-end operation. Users can build flows using a range of available actions such as connectors, loops, switches, custom code and more.
Sample flow getting data from a Shopify source and storing it in a fastn database
Users can find the current Flows in their project on the Flows page accessible from the left side bar menu.
Main Flow Page
Canvas
Flows are built using the flow canvas page.
The canvas page allows users to drag and drop flow elements from the right side menu and connect them together.
Additional tools available on the Canvas are the Debugger to test flows in the platform, Embed tool to get generated code for code integrations and a Deploy tool to deploy a "LIVE" version of the created flow.
Canvas Page
Flow Types
Flows can be configured as either APIs that give a synchronous real-time response or Workflows that are executed as asynchronous jobs.
APIs and Workflows have a similar structure, but the manner of execution differs.
Flow Types
Synchronous Flows - APIs
Building a flow as an API allows users to utilize them as REST APIs. The API endpoints can be generated using the "Embed this Flow" tool available in the Canvas and integrated in code or triggered through API management tools like Postman.
Fastn can generate code to embed or call APIs
Sending a request to the fastn API endpoint will run the flow and wait for a response until the flow completes or times out.
Asynchronous Flows - Workflows
Setting up a flow as a workflow allows users to execute it asynchronously.
Workflows can be initiated through configured webhook URLs or through the generated endpoints where a request can be sent.
This triggers the workflow to be added to a job queue and in response a job id is returned while the job is processed in the background.
Workflows and Webhooks
Since workflows are async jobs, the ideal way to use them is with webhooks and its scheduling feature.
Once a workflow is built and deployed it can be linked to a webhook.
Webhooks provide two types of links Routes and Triggers (Scheduler).
Routes give users a webhook url that can be tied to a route. A configured route will run its assigned flow every time the webhook url is triggered externally.
Generated Webhook URL
Route Configuration - this will trigger a workflow named test whenever the Webhook URL receives a request
Triggers can be configured for auto-triggering the webhook and its configured workflow based on a schedule.
Trigger Configuration - this will trigger a workflow named test as per the configured schedule
Deployments
Once a flow is built it can be treated as "DRAFT" and can be triggered using the available "Debugger" or the DRAFT REST API url generated by fastn.
In order to deploy a LIVE version that can be triggered through widgets and webhooks, users can click on the "Deploy" button on the top-right section of the canvas.
Once deployed the status will be updated on the Flows page.
Flow Templates
The fastn platform allows users to save flows as templates.
The saved templates can be imported by other users within the same organization or workspace.
Flow Elements
Connectors
Connectors are used to link flows to external data sources and APIs.
Database
Database elements are used to add internal fastn DB interaction in the flow such reading data or creating data through SQL queries.
Data Mapper
Data Mappers are used to map incoming data into an output object. Data can be retrieved from different steps in the flow as well as variables and secrets.
Variables
This flow element allows users to set variables that can be used throughout their flows. Variables support different data types such as integers, strings and objects.
Switch
Switches can be used to create condition based sub-flows or branches.
Loop and EndLoop
Loops are used to create repetitive sub-flows.
The loop flow element allows users to configure different flow types.
- Loop N times: Execute loop for configurable number
- Loop Over Data: Ideal for cycling through collections of data, iterating over each element.
- While Loop: Perfect for repeating a set of actions as long as a specific condition holds true.
The End loop element is used to define end conditions for certain loops in order to exit out of them.
Download File
This element allows users to download a file from a source URL and use it in the flow.
Logger
The Logger step allows users to add a log which return static text or objects variables that are accessible in the flow.
Converter
The converter element is used to convert JSON data into other formats.
Custom Code
This element allows users to write custom code for data processing within the flow.
This gives the users the ability to utilize solutions available through code in their flows when required.
Flow Responses - Success and Error
Success and Error response elements can be used to tailor response messages and returned objects of your flow in case of specific HTTP response codes.
Lambda Function
Adding a Lambda function element allows users to setup a function in Python that executes externally to process data in the flow.
Insights
The insights page is used to view logs related to executed flows.
It also gives information around response times, error codes and which steps the flow executed successfully.
Flows are a core part of how users create APIs and Workflows with low code tools as we will continue to explore.