Blog
Ideas to help you sell more through WhatsApp

Practical articles about marketing, automation, and sales through WhatsApp from the WhatsLoop team

Building Advanced WhatsApp Bot Workflows with Conditional Logic

Learn to build advanced WhatsApp bots with conditional branching. From automated lead qualification to intelligent conversation routing.

WhatsLoop Team|December 18, 2025|10 min read
Building Advanced WhatsApp Bot Workflows with Conditional Logic

What Are Advanced Bot Workflows?

A simple bot responds to keywords with fixed replies. An advanced bot thinks. It makes different decisions based on multiple conditions: who the customer is, what they said, when they reached out, and their history. This difference transforms a bot from an auto-reply tool into an intelligent assistant that guides customers toward the desired outcome.

In WhatsLoop, the visual bot builder lets you create complex workflows without writing a single line of code, using a system of conditions, variables, and branches.

Understanding Conditions and Variables

Types of Conditions

A condition is a question the bot asks itself before deciding the next step:

Text conditions: Does the customer's message contain the word "price"? Does it start with "I want"? Does it exactly match "yes"?

Numeric conditions: Is the order value greater than 500 SAR? Is the number of previous orders equal to zero?

Time conditions: Is the current time within business hours? Has more than 24 hours passed since the last message?

Segment conditions: Is the customer in the "VIP customers" segment? Have they purchased within the last 30 days?

Channel conditions: Did the customer reach out from the website widget, a Facebook ad, or directly?

Variables

Variables store information that accumulates during the conversation:

  • {customer_name}: The customer's name
  • {selected_product}: The product they chose
  • {total_orders}: Total previous orders
  • {last_visit}: Date of last contact
  • You can create custom variables as needed

Building an Advanced Bot Flow

Example 1: Intelligent Sales Bot

Customer sends any message
↓
[Condition] Is the customer new or existing?
├── New → Welcome message + ask about interests
│   ↓
│   [Condition] What is their interest?
│   ├── Products → show catalog
│   ├── Services → show service list
│   └── Pricing → show pricing plans
│
└── Existing → [Condition] Do they have an open order?
    ├── Yes → show order status
    └── No → "Welcome back! How can we help?"

Example 2: Tiered Technical Support Bot

Customer describes their issue
↓
[Condition] Do keywords relate to "payment" or "invoice"?
├── Yes → Financial support path
│   ↓
│   [Condition] Is the amount greater than 1000 SAR?
│   ├── Yes → Immediate transfer to specialized human agent
│   └── No → Attempt automatic resolution + self-service link
│
├── Related to "technical" or "not working"
│   ↓
│   Automatic diagnostic questions
│   ↓
│   [Condition] Did the solution work?
│   ├── Yes → Close + satisfaction rating
│   └── No → Transfer to technical support
│
└── Unclear → "Could you please elaborate?"

Example 3: Booking Bot with Dynamic Conditions

Customer requests an appointment
↓
[Condition] Are there available slots today?
├── Yes → Show available time slots
│   ↓
│   Customer selects a slot
│   ↓
│   [Condition] Does the service require prepayment?
│   ├── Yes → Send payment link
│   │   ↓
│   │   [Wait] Payment confirmation
│   │   ↓
│   │   Confirm booking + send reminder 24 hours before
│   └── No → Confirm booking immediately
│
└── No → "Available slots tomorrow: ..."

Nested Conditions

You can nest conditions at multiple levels to handle precise scenarios:

Example: Special Offer by Segment and Region

[Condition 1] Is the customer VIP?
├── Yes
│   └── [Condition 2] Do they live in Riyadh or Jeddah?
│       ├── Yes → 25% discount + free delivery
│       └── No → 20% discount + reduced delivery
└── No
    └── [Condition 2] Have they purchased within the last 90 days?
        ├── Yes → 10% discount
        └── No → Show best-selling products without discount

Loops and Iteration

Question Loop

The bot asks a series of questions and collects answers:

  1. "What is your full name?" → saves to {name}
  2. "What is your city?" → saves to {city}
  3. "What service do you need?" → saves to {service}
  4. If any answer is unclear → repeat the question (maximum 3 attempts)
  5. After all questions are complete → summarize and ask for confirmation

Follow-Up Loop

  • After sending a price quote → wait 4 hours
  • If the customer has not replied → send first reminder
  • Wait an additional 24 hours
  • If no reply → send final reminder with an alternative offer
  • If still no reply → close the conversation and mark as "cold lead"

Connecting Conditions to External Systems

Inventory Check

The bot connects to the inventory system and verifies:

  • Is the product in stock? → show price and purchase option
  • Out of stock? → show alternatives or register for back-in-stock notification

Order Status Check

The bot retrieves order status from the shipping system:

  • "Being prepared" → inform customer of expected time
  • "Shipped" → send tracking number
  • "Delivered" → request experience rating

Best Practices

  1. Start simple and add complexity gradually: Do not build 20 conditions on day one
  2. Test every path: Ensure each branch works before going live
  3. Always provide a human exit: At any point, the customer should be able to say "I want to talk to a person"
  4. Log exceptions: Every message the bot could not understand should be saved for later improvement
  5. Review reports weekly: Identify drop-off points and ask "Why do customers leave here?"

Conclusion

Advanced bot workflows transform WhatsApp from a chat channel into an intelligent automated system. Conditions and variables are your tools for building a personalized experience for each customer, and the more data you collect, the smarter your decisions become.

Sign up for WhatsLoop and start building intelligent bots with an easy-to-use visual builder.

Frequently Asked Questions

Q: Do I need coding experience to build advanced WhatsApp bot workflows? A: No, WhatsLoop provides a visual bot builder that lets you create complex workflows with conditions, variables, and branches without writing a single line of code. You can drag and drop elements and connect them visually.

Q: What types of conditions can be used in a WhatsApp bot? A: You can use text conditions (analyzing message content), numeric conditions (order value or purchase count), time conditions (business hours or wait duration), segment conditions (customer classification), and channel conditions (customer contact source).

Q: How does an advanced bot handle questions it does not understand? A: A human exit should always be available at any point in the flow. Every message the bot fails to understand is saved automatically for later improvement. Adding an "I want to talk to a person" option at every stage ensures customers can reach a human agent when needed.

Q: Can a WhatsApp bot connect to external systems like inventory or shipping? A: Yes, the bot connects to inventory systems to check product availability and retrieves order status from shipping systems automatically. It can inform customers about stock levels, show alternatives, or send tracking numbers based on order status.

Share
#WhatsApp Bot#Automation#Customer Service#Guide
Why WhatsLoop

Everything you need for smarter communication

A complete platform that brings all communication and sales tools in one place

5min

Quick Setup

Connect your number and start in 5 minutes with zero complexity

Security & Privacy

Fully encrypted data with granular permissions for every user

Meta Verified

Official WhatsApp

Meta-certified API with the green verification badge

Receive
Process
Reply

Smart Automation

Bots and workflows running 24/7 without intervention

+5

Multi-Agent

One number, a full team behind it with roles and permissions

POST /v2/send
{ "to": "966..." }
200OK

Developer API

API + SDK + Webhooks to connect any system you have

Your business deserves smarter communication with WhatsLoop

Thousands of businesses rely on WhatsLoop to manage communication, automate sales, and elevate customer service. Get started today and see the difference from day one.

Start Now
  • Setup in minutes
  • Fully encrypted data
  • 24/7 technical support
  • Official Meta-verified WhatsApp
  • Connects with thousands of apps & platforms
Chat with us on WhatsApp