Integrating Rules
Rulebricks Flows

Rule Flows

Flow Header

Rule Flows are a powerful way to chain together multiple rules, alongside calls to external services, and structure complex decision-making workflows.

Flows are particularly useful when you have a series of decisions that need to be made in a specific order, or when you'd like to separate logic into multiple rules for easier maintenance of your decision-making logic.

Flow Reactivity

Unlike most other workflow builders, the Rulebricks Flow editor is reactive— as you make changes to rule input fields, the editor automatically visualizes your data flow in real-time. This makes it incredibly easy to see how your flow behaves as you build it without repeated build/test cycles.

Reactivity applies to all sequences of nodes until certain execution or query nodes are reached. These nodes pause execution until you manually click the run button, preventing accidental spam to external services.

While this feature exists to help you model your flow while understanding what is happening to the actual data as it moves through, it is not a guarantee of Flow data– for that, simply use the "Try" or "Test" tabs, available in the sidebar.

Creating a Rule Flow

Navigate to the Flows tab

Open the Rulebricks dashboard and click the Flows tab.

Create a new flow

Click the Create Flow button to create a new Rule Flow.

Create Flow Modal

⚠️

You must have at least one published rule in your workspace to use as a starting point for your flow.

Build your flow

You'll be taken to the Flow editor where you can:

  • Drag and drop published rules from the sidebar onto the canvas
  • Add flow functions (code execution, API calls, etc.)
  • Connect nodes together to define the execution order

Flow Editor Entry

Connect your nodes

Drag from an output handle of one node to the input of another to connect them. Data flows through the connections.

Try Connecting

Flow Functions

Flow functions are special operations you can use in your flows to perform various actions beyond rule execution.

Flow Functions

More Flow Functions

Continue If

Continue If

Proceed based on one of four selectable conditions:

  • If a specific property is "truthy" (not empty, non-zero, non-null)
  • If a specific property is exactly true
  • If a specific property is exactly false
  • If a specific property is "falsy" (empty list, zero, null, or false)

If the condition is met, the flow continues along the exiting edges. Use two "Continue If" nodes to model if/else logic.

💡

All data you want to proceed with after a Continue If node must be wired in as inputs.

Result Object

Result Object

The final output of your flow. It collects results from all preceding nodes and returns them as the flow's response.

  • You can use multiple Result Object nodes with unique keys
  • Required: Every flow must end with at least one Result Object node

Lookup Table

Lookup Table

Look up a value in a table and return a corresponding value if an exact match is found. Works well with Continue If nodes by returning true/false based on lookup results.

Run Code

Run Code

Run custom JavaScript code using data from your flow. Useful for:

  • Making calls to external services
  • Performing complex calculations
  • Custom string formatting or data transformation

Available libraries: fetch, moment, lodash, and more.

Access connected values via the inputs dictionary and return values via the outputs dictionary.

// Example: Calculate discount
const total = inputs.subtotal
const discount = total > 100 ? total * 0.1 : 0
outputs['discount'] = discount
outputs['final_total'] = total - discount

Database Query

Database Query

Query a PostgreSQL database and return results. Variables from your flow can be used in the query.

Features:

  • Use rows with a For Each node or send directly to Result Object
  • Built-in 1-minute caching for performance

API Request

API Request

Make HTTP requests to external APIs. Variables from your flow can be used in the URL, headers, and body.

Features:

  • GET, POST, PUT, DELETE methods
  • Custom headers and authentication
  • Built-in 1-minute caching

For Each

For Each

Iterate over a list of items and apply a rule to each one. Perfect for:

  • Transforming collections of objects
  • Processing lists of orders, users, or products
  • Batch operations
⚠️

For Each nodes must culminate in a Result Object node. Values inside the loop cannot connect to parts of the flow outside that loop (indicated by different edge colors).

AI Inference

AI Inference

Extract structured data from text using OpenAI. Useful for:

  • Parsing emails and reports
  • Extracting specific information from documents
  • NLP preprocessing before rule execution

To use:

  1. Connect a text input
  2. Define target labels to extract
  3. Click "Run Inference"

Vault

Vault

Securely retrieve sensitive information from cloud secrets managers (AWS, GCP, Azure).

Security features:

  • Secrets never appear in clear text in the flow
  • Cannot be logged or returned in output
  • Only accessible within Run Code nodes