Using Flow Logic in Landbot

Cesar Banchio Updated by Cesar Banchio

Core Concepts of Flow Logic

Flow logic lets you manage how conversations progress. You can evaluate user input, manipulate data, make decisions, and guide the conversation based on rules. Landbot provides two main tools for this: Conditions blocks and Formulas blocks.

When to Use Conditions vs. Formulas

Use Conditions for clear-cut logic—like checking if a value exists or meets a specific criterion. They're ideal for routing the user through different paths.

Use Formulas when you need to manipulate or transform data (e.g., split a string, calculate a score, or validate input). Formulas are also better for chaining logic steps.

Using the Conditions Block

The Conditions block is used to evaluate one or more variables using logic rules. Each rule checks a condition, such as:

  • EQUALS TO – checks if a variable is exactly equal to a specific value
  • DOES NOT EQUAL TO – checks if a variable differs from a given value
  • CONTAINS – verifies whether a string or array includes a specified value
  • GREATER THAN – compares numerical values to determine if one is larger
  • LESS THAN – checks if one numerical value is smaller than another
  • IS SET – confirms if a variable has been initialized or holds any value

You can chain multiple rules using:

  • AND – all conditions must be true
  • OR – at least one condition must be true

The block's green output will be followed where the condition is TRUE and the RED outpud will be when it is FALSE

For more information on this block, please refer to this article.

Using the Formulas Block

With the formula block we can evaluate fields with the Logical and Comparison formulas, as well as perform calculations or modifications to data the field has.

Logical Formulas
  • And(a, b)
  • Or(a, b)
  • Not(a)
  • If(condition, trueValue, falseValue)
Comparison
  • IsSet(variable)
  • IsEqual(a, b)
  • IsNotEqual(a, b)
  • IsGreater(a, b)
  • IsGreaterOrEqual(a, b)
  • IsLess(a, b)
  • IsLessOrEqual(a, b)

The Formula block includes formulas for different data types such as Text, Number, and Array. For a detailed overview of all formulas, please refer to this article.

Error Prevention Tips

  • Use Lower() to avoid case-sensitive errors.
  • Don’t forget to initialize fields.
  • Ensure conditions have fallback paths, meaning there are no dead ends.

Performance Considerations

  • Avoid overly complex nested formulas.
  • Reuse sub-flows instead of duplicating logic.

Tips for Building Efficient Logic

💡 Use Formulas when you need complex evaluations or calculations.

💡 Keep Conditions blocks clean, split logic into multiple blocks when needed.

💡 Test each logic branch thoroughly using the Preview mode.

💡 Debug Tip: Use a Message block to display variable values during testing. It helps you understand how the logic behaves step by step.

Was this article helpful?

Note block

Contact