What is this?
If and Switch are the two elements in the Logic group of the Add content palette in the Flow Builder. They make part of a screen appear only for some customers, based on answers they have already given:- If — “Show content only when a condition is true.” You choose a question, how to compare it, and the answer to look for, then write what to show when it’s true (Then) and, optionally, what to show instead (Else).
- Switch — “Show different content for each answer.” You choose a question, then write the content to show for each answer it can have.
Logic can look at the answers to questions on the same screen and on earlier screens. The question must have a Field name.
What can I do here?
- Add an If with one or more conditions, joined by “all must be true” or “any can be true”
- Add a Switch with one case per answer
- Fill each branch with headings, body text, captions, or copies of questions from the same screen
- See a plain-words summary of the rule right in the screen preview
How to use it
Add an If
1
Add the question first
An If reacts to a customer’s answer, so the screen (or an earlier screen) needs a question. If there isn’t one yet, the If settings say Add a question first — “If and Switch react to what the customer answers. Add a question to this screen, then choose it here.” — and offer quick buttons for Single choice, Dropdown, Short answer, Date picker, and Opt-in. A question added this way is placed just above the If.
2
Add the If
In the palette’s Logic group click If (or drag it onto the screen). Select it in the preview to open its settings.
3
Build the condition
Under Show this when, choose a question from Choose a question. Questions are grouped as This screen and Earlier screens (earlier ones show the screen title after the label). Next choose how to compare, then the answer.
4
Fill Then and Else
Add what customers see when the condition is true under Then: show this and, optionally, what they see otherwise under Else: show this instead. See Fill a branch.
For other comparisons you type the value into Type a value (a number box for numbers, a date box for dates). Single choice and Dropdown whose options load from an endpoint are compared as text. Multiple choice, Chips, Upload, and a Calendar set to a date range can’t be used in a condition — WhatsApp can’t compare them, so they don’t appear in the list.
Several conditions. Click Add condition for another row, and the trash icon (Remove condition) to delete one. Once there is more than one, choose All must be true or Any can be true. A row only counts once it is complete — an unfinished row (no answer picked yet) is ignored. Below the rules, Shown when: gives a plain-words summary such as “Which department? is Dental and Age is at least 18”.
Edit as text. Click Edit as text to see the condition WhatsApp will receive and edit it directly. If a condition was written by hand in a way the rule builder can’t show, you’ll see “This condition was written by hand, so it can’t be shown as rules. Edit it here, or start over with rules.” — click Start over with rules to build it again with the picker.
In the preview. The If appears as a dashed box saying Show when followed by the rule in words, with a second line such as Then: 1 · Else: 0 counting the items in each branch. Until you pick a question it says Choose what this depends on.
Add a Switch
1
Add the Switch
In the Logic group click Switch and select it in the preview.
2
Pick the question
Under Switch on question, choose the question. If the screen has no questions yet you’ll see Add a question first, as with If.
3
Add a case for each answer
Under Add a case for each answer, click an answer to add its case, or Add every answer to add all the remaining ones at once. The message Every answer has a case. appears when none are left. For a Single choice or Dropdown with options you typed, the answers are those options; for an Opt-in they are
true and false.4
Fill each case
Each case is headed When question is answer, with a trash icon to delete the case. Fill it in as described in Fill a branch.
Fill a branch
Each Then, Else, or Switch case has the same editor. [SCREENSHOT: flows-logic-branch-editor — A branch with a text block (type selector and text box), a copied question, the Remove button, and the Add content menu open]- With nothing in it, it says “Nothing here yet. Add the text or question to show.”
- Click Add content to open a menu. Choose Large heading, Small heading, Body, or Caption to add a text block with the starting text Your text here. Under Copy a question from this screen, choose a question already on the screen to copy it into the branch.
- A text block has a dropdown to switch between heading, body, and caption, and a Type the text to show box to write the words.
- A copied question shows its label with “(copied from this screen)” after its type. You can’t edit it inside the branch — change the original, or use the trash icon (Remove) to take the copy out.
Troubleshooting / Technical Notes
- “Add a question first.” The If or Switch has nothing to react to. Add a question (the quick buttons add one above the If or Switch) or move the logic to a later screen.
- The question I want isn’t in the list. Only questions on this screen and earlier screens appear, only if they have a Field name, and not Multiple choice, Chips, Upload, or a Calendar set to a date range.
- Save says “invalid condition”. The condition is incomplete or was typed by hand with a mistake. The message ends with the reason in brackets — for example it must refer to at least one question, text values need quotes, and
===orandaren’t allowed. Rebuild it with the question picker, or use Start over with rules. - Save says “then branch must contain at least one component”. Add something to Then: show this.
- Save says “value is required” or “at least one switch case is required”. Choose a question under Switch on question and add at least one case.
- My condition shows “Choose what this depends on” in the preview. No complete rule exists yet — pick a question, a comparison, and an answer.
- A branch can’t hold the element I want. Branches take text blocks and copies of simple questions only. Put other content on the screen itself, or on its own screen.