Logic

Nodes and connections

A function is built from nodes. Each node takes values in, does one thing and passes values out through its connections.

How a graph works

Every node has input ports on one side and output ports on the other. A connection carries a value from an output port to an input port. The function runs by following those connections.

Use Add node in the Node Editor to place a node.

Open a node with Edit Config to change its settings, and give it a label with Add Label.

What is this node? explains each node inside the editor.

A function can hold up to 500 nodes and 1000 connections.

Node categories

Add node groups the nodes into these categories.

Inputs/Outputs

Input receives a value from the caller. Output returns a value to it.

Data

Constant, Set Variable and Get Variable.

Math, Logic, String, Array and Object Operations

Arithmetic, comparisons, text handling, lists and objects.

Type Conversion and Date/Time Operations

Convert between text, numbers and JSON; get, format, shift and compare dates.

Control Flow

If (Conditional).

Database Queries and API Calls

Execute Query runs a custom query. Execute API calls a registered API.

Authentication

Get User ID and Get Admin ID return who is making the request.

Events

Subscription Event, User Created Event and Scheduled Event read what started a trigger run.

System

Get Env Value, Random String, Random UUID and Random Integer.

Inputs and outputs of the function

Input and Output nodes are the function's contract with whoever calls it: a page event, a form or a test.

An Input node has a parameter name and a type: number, string, boolean, array, object or any. Always set the type.

An Output node returns its value under the name of its input port. Name that port what the caller should see, such as total or products.

Two Output nodes whose ports share a name overwrite each other.

An input port with nothing connected needs a default value, or must be marked optional, or the run fails.

The If node

If (Conditional) has three inputs: condition, trueValue and falseValue. It passes on one of the two values depending on the condition.

Nodes that only feed the branch that was not taken are skipped. That makes the If node the way to guard a query or an API call so it only runs when it should.

Good habits

Saving only checks each node's shape. A missing connection or a missing input only shows up when the function runs, so test after every save.

Pass values through connections. A Get Variable node with no incoming connection can run before its Set Variable.

Never put a secret in a Constant. Read it with Get Env Value instead.

To act on the signed-in user's own data, read their id with Get User ID. Never take it from the page.