Workflow conditions and branching: if, switch and AND/OR groups
Learn to use workflow conditions in Omnifox: the If node, multi-branch Switch, AND/OR groups, Contact has tag and Business hours to route every chat.
A workflow with no conditions is a straight line: it treats every contact the same way. Workflow conditions are the brain of your automation, because they decide where each conversation goes based on who wrote in, which channel they used, what they said, and what time it arrived. In Omnifox a workflow is always one trigger + a graph of nodes, and conditions are the nodes that open several exits (edges) so each case follows its own path.
This guide walks through the real condition nodes in the editor: If (single rule), Switch (multiple branches), nested AND/OR groups, Contact has tag and Business hours. By the end you will have a complete routing example ready to copy.
The If node: the simplest decision
If (single rule) evaluates one condition and opens two exits: true and false. It is the classic binary fork.
A typical flow:
- Trigger Message received (filter: first message only).
Ifnode -> rule:{{$conversation.channel_name}}is WhatsApp.- True branch ->
Send WhatsApp template. - False branch -> plain
Send message.
The power of If is that you can evaluate any contact, conversation or message variable. For instance, branch on whether {{$contact.company}} is empty to separate B2B clients from end consumers. Remember the engine's key rule: an unknown variable resolves to an empty string, so it never breaks the evaluation.
Switch: more than two paths
When you need more than two exits, Switch (multiple branches) is the right tool. Each branch has its own rule set and the flow takes the first one that matches, top to bottom, with a fallback exit at the end for anything that does not fit.
A common case is routing by keyword or by contact stage:
- Branch 1: text contains "invoice" ->
Transfer to an agenton the billing team. - Branch 2: text contains "pricing" or "plans" ->
Assign AI agentfor sales. - Branch 3 (fallback):
Send messagewith the menu of options.
Order matters: put the most specific rules on top and leave generic ones below. If two branches could both match, the first one wins.
AND/OR groups: logic that reads like a sentence
Real rules are rarely about a single field. Omnifox supports nested groups to combine conditions with AND and OR, like (A AND B) OR C. This turns a complex decision into something readable.
Example of a group inside an If node:
(
{{$contact.tags}}contains VIP ANDBusiness hours= In hours) OR{{$conversation.channel_name}}= Calls
In other words: respond instantly if it is a VIP client during business hours, or if the contact arrives through the calls channel regardless of tags. Groups save you from chaining three or four If nodes in a ladder; all the logic lives in one node and stays easy to audit.
Contact has tag: segment without writing rules
Contact has tag is a dedicated condition that checks the contact's tags and opens a branch for presence/absence. It is much cleaner than comparing {{$contact.tags}} against free text.
Pair it with the Tag added trigger or with a previous Add tag node to build funnels:
- Trigger Message received.
Contact has tag-> has customer?- Yes ->
Transfer to an agentin post-sales. - No ->
Add taglead andAssign AI agentfor sales.
Business hours: the three-branch condition
Business hours is special because it opens not two but three exits: In hours, Out of hours and Holiday. It reads your workspace's schedule and holiday calendar, so you never hard-code dates.
A widely used auto-reply pattern:
- Trigger Message received.
Business hourscondition.- In hours ->
Transfer to an agent. - Out of hours ->
Send message: "We reply in the morning" +Snooze conversation. - Holiday ->
Send WhatsApp templatewith the holiday notice.
An end-to-end routing example
Let's combine everything into a single front-desk workflow:
Message received (first only) -> Business hours
- Holiday ->
Send message(holiday) -> end. - Out of hours ->
Send message+Snooze conversation. - In hours ->
Switch:- contains "support" ->
Contact has tagVIP? -> Yes:Transfer to an agent(senior) / No: normal queue. - contains "sales" ->
Assign AI agent. - fallback ->
Ask a questionwith the menu.
- contains "support" ->
With five condition types you cover practically any omnichannel routing.
Common mistakes and best practices
- Never leave dead-end branches. Every condition must close all its branches; a
Switchwith no fallback strands conversations. - Order specific to general in
Switch: the first true rule wins. - Prefer
Contact has tagover comparing tag text by hand; it is more robust. - Lean on
Business hoursinstead of looseDate/timenodes: it keeps holidays centralized. - Test edge cases: empty variable, contact with no tags, message after hours.
You can build all of this visually by dragging nodes in the Omnifox workflow editor and testing each branch before publishing. Start with a simple If, then add Switch and AND/OR groups as your operation grows: tomorrow your conversations will route themselves.
Comentarios (0)
Todavía no hay comentarios. Sé el primero en compartir tu opinión.
Dejá un comentario
Tu email nunca se publica. Los comentarios se moderan antes de aparecer.