Flows
A brief walk through of how to build Flows in the canvas.

Overview

Flows are visually compiled endpoints that make it easy to build apps with any of our supported platforms and partners, including Coinbase, Stripe, Shopify, Airtable, MongoDB, Github, Supabase, Twitter, Webflow, Ethereum, Tatum and many more.
In this section, we'll answer the following questions:

How do Triggers work?

Triggers are the control center of your Flow. They let you customize your Flow's endpoint URL (the URL used to call your Flow) and set its Response.

Setting a Response

To set a Response, simply click on the Response button found in the Trigger node and set your response data in the code editor.
In the Trigger, you have access to the $trigger object and the $nodes object.
Setting a flow response from the trigger node
Property
Default Value
status
Response status code
200
status
Response headers
1
{
2
"cache-control": "no-cache",
3
"content-length": "1905",
4
"content-type": "application/json; charset=utf-8"
5
}
Copied!
body
Response body
1
{
2
status: "success",
3
message: "Hello World ⚡️"
4
}
Copied!

How do Nodes work?

Nodes are the brains of your Flow. They let you customize the executable logic that is triggered when your Flow is called.

Adding your first node

To get started, add your first Node below the Trigger. To do this, simply click the + button that appears when you hover over the trigger node. All Templates are also 100% open-source and available on Buildable's Github under the MIT license.
Adding a Node to a Flow
Buildable makes it easy to add various types of custom and integration-based Nodes via Templates. You can view a list of available Node Templates here:

Customizing your Node

Every node is comprised of its input (the data needed to run the Node) and run function (the Node's executable logic). You can easily access either using the Input and Code buttons found on the front of each node.
Easily open the Input or Code of a Node to customize it
Input
Run
The input function’s sole purpose is to select the data that will be passed into the run function of that node.
It has access to:
  • $trigger - The flow's request object
  • $nodes - The outputs of all nodes above itself
It’s important to make sure your input function is only used for selection and not for processing. Following best practices, you shouldn’t write any logic within the Input function.
Below is an example of the input function.
1
/**
2
* Lets you select the input for your node
3
*
4
* @param {Params} params
5
* @param {Object} $trigger - This flow's request object
6
* @param {Object} $nodes - Data from above nodes
7
*/
8
const nodeInput = ({ $trigger, $nodes }) => {
9
return {
10
name: $trigger.body.name
11
}
12
}
Copied!
The run function is where you write the processing and logic of your node. Whatever is returned in the run function will be the response of the node.
It has access to:
  • input - The values passed in from the input function
Below is an example of the run function, accessing the values we passed in from the input function.
1
/**
2
* @param {Run} input
3
*/
4
const run = (input) => {
5
return {
6
message: `Hey, ${input.name}!` // Passed from the input function
7
};
8
}
Copied!

Understanding Global Variables

The input function of your nodes will have access to 2 global variables, which are $trigger and $nodes. The below section highlights both types.
1. $trigger
  • method- The request method (GET, POST, PUT, PATCH, or DELETE).
  • headers - The request headers.
  • params
    • env - The environment that you’re testing in.
    • flowPointer - Your flow’s unique slug.
    • p0pN - Params passed in via the URL. Each param will have the property name pN, where N = the param’s position in the URL.
  • query
    • Query data passed via the URL.
  • body - Data passed to the body. This will not be parsed if the request method is GET.
2. $nodes
An object of objects, containing the output of each node above the current node. The image below outlines the available context for each node using arrow pointers. As visible, only the Trigger Node has access to the output of all nodes. Every node only has access to the outputs of the nodes above it.
How to think about node access