Table of Contents

Conditions block: check Fields and split the conversation

Desirée M Updated by Desirée M

The Conditions block checks the value of a Field and splits the conversation in two: the green output when the condition is true, and the red output when it's false. It's how your agent remembers what a visitor said earlier and answers each visitor in the way that fits.

To compare dates, greet returning visitors or check whether your team is online, the Conditions block uses the Fields Landbot fills in on its own, explained in Conditions block: check dates, visitors and team members online.

The Conditions block is available on the Starter and Professional plans.

Prefer watching? The Academy video tutorial shows the Conditions block step by step.

How to add a Conditions block

To add a Conditions block, drag from the output of any block onto an empty part of the canvas, type Conditions in Search by name and select Conditions. The + button at the top left of the builder opens the same list of blocks.

Add-block menu with Conditions typed in Search by name and the Conditions block highlighted in the results

How to set up a condition

To set up a condition, open the block and fill in the three boxes under Set the condition(s):

1️⃣ In IF @, click Type or select the field and pick the Field to check, for example flavor.

2️⃣ In the dropdown below it, choose how to compare the Field, for example EQUAL TO.

3️⃣ In Type a value or select a field, type the value to compare with, for example Pistachio. To compare with another Field instead, click Use field.

Conditions panel checking if the flavor Field is equal to Pistachio, next to the block on the canvas showing the same condition

Once you close the panel, the block on the canvas sums up the condition, for example "IF @flavor EQUALS Pistachio". That way you can follow the flow at a glance, without opening each block.

Which comparisons can a condition make?

A condition can compare a Field in six ways, chosen from the dropdown under the Field:

Conditions panel with the dropdown open, listing equal to, does not equal to, contains, greater than, less than and is set

● EQUAL TO: the Field's value is exactly the value you typed.

● DOES NOT EQUAL TO: the Field's value is anything else.

● CONTAINS: the value you typed is part of the Field's text (pist is part of pistachio), or one of the options saved in a list.

● GREATER THAN and LESS THAN: the Field's number is above or below the value. Both are strict, so 5 isn't less than 5.

● IS SET: the Field has a value, whatever it is. It needs no value box.

On the canvas, the block shortens EQUAL TO and DOES NOT EQUAL TO to EQUALS and NOT EQUALS.

Conditions are case-sensitive: if a visitor types pistachio and the condition checks EQUAL TO Pistachio, the condition is false.
GREATER THAN and LESS THAN need a Field with the Number format. A text Field that holds a number is compared as text, so 10 isn't greater than 9.

What happens when a condition is true or false?

When a condition is true, the conversation follows the Conditions block's green output; when it's false, it follows the red output. Connect each output to what the agent should say or do in that case.

Conditions block checking if flavor equals Pistachio, with a green path to a bestseller message and a red path to a coming-right-up message

In this example, an ice cream shop agent asks visitors how many scoops, which flavor and which toppings they want. Once the order is in, a Conditions block checks whether @flavor is EQUAL TO Pistachio:

● Green output (true), pistachio: "Pistachio, our bestseller! 💚 Your toppings are on the house today."

● Red output (false), any other flavor: "Great choice! Your Mango ice cream is coming right up 🍦". The message includes @flavor, so each visitor sees the flavor they picked.

Right after a Buttons block, each button's own output is the simplest way to branch. The Conditions block is for decisions that come later in the flow, like the ice cream shop checking the flavor once the toppings are in, or for decisions that depend on more than one answer.

How to check several conditions with AND or OR

To check more than one condition in the same block, click the red + under the first condition and set up the next one. Between the two, choose AND or OR:

● AND: the green output runs only when every condition is true.

● OR: the green output runs when at least one condition is true.

Conditions block with two conditions joined by OR, checking for pistachio flavor or nuts in the toppings, with a nut allergy heads-up message

In this example, an ice cream shop agent warns visitors when their order contains nuts. Pistachio ice cream is made with nuts, and nuts are also a topping, so a Conditions block checks whether @flavor is EQUAL TO Pistachio OR @toppings CONTAINS Nuts:

● Green output (true), pistachio or nuts in the order: "Heads-up: your order contains nuts 🥜 Tell us if you have an allergy."

● Red output (false), no nuts anywhere: the agent skips the heads-up and goes on with the order.

The toppings question is a Buttons block with multiple choices, so @toppings saves a list, and CONTAINS checks whether Nuts is one of the toppings picked. That's why a visitor who orders mango with sprinkles and nuts gets the heads-up too:

Chat where the visitor orders mango with sprinkles and nuts and the agent replies with a nut allergy heads-up

There's no DOES NOT CONTAIN option. To do something when a list doesn't include an option, check it with CONTAINS and build that step on the red output.

How to check a range of numbers

To check whether a number falls between two values, add two conditions on the same Field and join them with AND: one GREATER THAN the lower value and one LESS THAN the higher value.

Conditions block checking if scoops is greater than 1 and less than 5, with a stacked-cone message and a cup message

In this example, an ice cream shop agent stacks orders of 2 to 4 scoops on a cone and serves the rest in a cup, so a Conditions block checks whether @scoops is GREATER THAN 1 AND @scoops is LESS THAN 5:

● Green output (true), 2 to 4 scoops: "Stacked cone coming up! 🍦🍦"

● Red output (false), 1 scoop or 5 and more: "We'll serve it in a cup 🍨"

The scoops come from an Ask for a Number block, so @scoops is a Number Field and the comparison works on numbers.

Join a range with AND, not OR. With OR, every number is either greater than 1 or less than 5, so the condition is always true.

How to check whether a Field has a value

To check whether a Field has a value, pick the Field and choose IS SET. The condition is true when the Field was saved earlier in the conversation, and false when it's still empty, for example because the question that fills it never came up.

Conditions block checking if the email Field is set, with a loyalty stamp message and an enjoy-your-ice-cream message

In this example, an ice cream shop agent offers a loyalty stamp, and only visitors who say yes are asked for their email. At the end, a Conditions block checks whether @email IS SET:

● Green output (true), the visitor left an email: "Stamp added! ⭐ We'll send your loyalty card to test@example.com". The message includes @email, so each visitor sees their own address.

● Red output (false), no email: "Enjoy your ice cream! 🍦"

With IS SET, the agent only promises a loyalty card to visitors it can actually send one to.

Frequently asked questions

Why does my condition always take the red output?

A condition takes the red output whenever the Field's value doesn't match what the condition checks. These are the usual causes:

● Upper and lower case: conditions are case-sensitive, so pistachio isn't EQUAL TO Pistachio.

● A number saved as text: GREATER THAN and LESS THAN compare a text Field as text, so a text Field that holds 10 isn't greater than 9. Save numbers with an Ask for a Number block or in a Field with the Number format.

● An empty Field: the question that fills the Field never came up in that conversation. To catch that case, check the Field with IS SET first.

Can I mix AND and OR in the same Conditions block?

No, a Conditions block uses either AND or OR for all its conditions. When you switch the toggle between two conditions, every toggle in the block switches with it. To combine both, chain two Conditions blocks: connect the green output of the first block to a second block that checks the rest.

Can I compare a Field with another Field?

Yes. To compare a Field with another Field, click Use field under Type a value or select a field and pick the second Field instead of typing a value. For example, @scoops GREATER THAN @max_scoops compares the visitor's scoops with a maximum saved earlier in a Set a Field block. When both are Number Fields, the block compares them as numbers, so 10 is greater than 9.

When you reopen the block, the value box shows the second Field as ¿·@max_scoops·? instead of its name. That's how the panel displays a Field picked with Use field, and the condition works as set.

How do I make a condition ignore upper and lower case?

To make a condition ignore upper and lower case, turn the answer into lowercase with a Formulas block before the Conditions block, then compare it with a lowercase value. For example, a Formulas block with Lower(@typed_flavor) saves PISTACHIO, Pistachio and pistachio alike as pistachio in @typed_flavor_lc, and the Conditions block checks whether @typed_flavor_lc is EQUAL TO pistachio.

Answers from buttons don't need this step: a button always saves its text exactly as written, so the case always matches.

For WhatsApp

The Conditions block works the same way on WhatsApp agents.

For Facebook Messenger

The Conditions block works the same way on Facebook Messenger agents.

Was this article helpful?

How to split bot traffic with the A/B Test block

Conditions block: check dates, visitors and team members online

Contact