Wachat · Automation

Catch the 50% of questions you already know

Half the messages your team answers are the same five questions: pricing, hours, shipping, refund status, where is my order. Chatbot Rules turns those into instant, branded replies with buttons and lists — before a human ever sees the conversation. No model training, no hallucinations, no surprises.

  • Exact, contains and regex matching modes
  • Priority ordering with first-match-wins
  • Reply with template, button or list message
  • Per-channel and per-time-window scoping
The problem

AI is overkill for "what are your hours?"

When teams adopt conversational AI, the instinct is to throw an LLM at every message. But the math rarely works for the long tail of trivial questions. A single GPT-4 call to answer "what time do you close" costs more than the entire ticket margin, takes 800ms, and occasionally hallucinates a closing time that was never in your knowledge base. The right answer here is a rule: if the message matches /hour|time|open|close|timing/i, reply with the canned hours block.

The second problem is observability. Rule-based bots from the 2010s lived in a black box — you had no idea which rules fired, which were dormant, or whether a typo in your regex was silently routing 8% of users into the wrong branch. Teams gave up on rules because they could not trust them.

Chatbot Rules in SabNode addresses both. Rules are fast (sub-50ms match), cheap (no model cost), and instrumented end-to-end. Every match is logged with the input, the rule, and the reply sent. You see exactly what is firing and tune accordingly.

What it is

Chatbot Rules, in depth.

Chatbot Rules is a deterministic pattern-matching layer that sits in front of every inbound message across WhatsApp, Instagram, Web Chat and Email. You define rules with three matching modes — Exact (case-insensitive equality), Contains (substring), and Regex (full PCRE) — and a reply action. When a message arrives, the engine evaluates rules in priority order and fires the first match. If nothing matches, the message falls through to your flow, your AI agent, or the shared inbox queue.

Each rule is more than a keyword. It can be scoped by channel (only WhatsApp), by time window (only outside business hours), by language (only Hindi messages), or by contact segment (only new contacts in the last 7 days). This means a single rule library serves your entire surface area without leaking across contexts — your "pricing" rule for Indian visitors shows INR, your "pricing" rule for international shows USD.

Replies are not limited to text. A rule can fire a WhatsApp template (with header media), an interactive button message (up to three quick replies), an interactive list message (up to ten options), or a free-form message inside the 24-hour service window. On Instagram, the same rule sends a DM with quick-reply buttons. On Web Chat, it renders rich cards. One rule definition, multi-channel output — that is the point.

The whole layer is observable. Every rule has a hit counter, a 7-day trend, and a debug feed showing the last 20 messages it matched. Rules that never fire surface in a "stale" panel so you can clean up cruft. Conflicts (two rules with overlapping patterns) are flagged at save time. And every match emits an event you can wire into Flow Analytics to measure deflection by rule.

Capabilities

Everything you get with Chatbot Rules.

7 capabilities
01

Three matching modes

Exact for menu-style flows ("MENU", "STOP"). Contains for fuzzy intents ("how much" matches "how much does it cost"). Regex for power users — /\b(refund|return)\b/i with full PCRE support including named capture groups you can reference in the reply.

02

Priority and first-match-wins

Rules execute in numeric priority order. A rule at priority 10 always evaluates before priority 50. First match short-circuits the rest. This makes conflict resolution deterministic — no more "why did the wrong reply fire" debugging sessions.

03

Scoped rule libraries

Scope by channel, language, contact tag, business hours, or segment. A "shipping" rule can have one version for B2B contacts and another for D2C, with no overlap. Scope rules surface as filters in the rule list so navigation stays sane.

04

Interactive button replies

Reply with up to three quick-reply buttons or a list with ten options. Button clicks become structured events that trigger downstream flows. This is the cheapest way to build a guided menu without paying for an LLM at every step.

05

Variable interpolation

Reference contact attributes, regex capture groups, business hours and current time in the reply. `Hi {{contact.first_name}}, your order {{match.1}} ships tomorrow.` Variables fall back to safe defaults if missing — no broken templates on empty fields.

06

Hit analytics and stale detection

Every rule shows hit count, last-fired timestamp, and a 7-day sparkline. Rules with zero hits in 30 days are flagged. You can A/B test two replies for the same rule with a 50/50 split and pick the one that drives fewer follow-up messages.

07

Escalation handoff

Any rule can include an "escalate after N replies" condition. If the same contact triggers the same rule three times in five minutes, the bot stops, drops a note in the inbox, and assigns the conversation to a human agent. Saves customers from rule loops.

Use cases

Built for the way teams actually work.

E-commerce
Case 01

Out-of-hours auto-reply with ETA

Single rule scoped to outside business hours, contains mode on "*", priority 99 (fallback). Replies with a template containing the next-open-time variable and a button to leave a callback request. Captures intent overnight without making it feel automated.

D2C
Case 02

Refund status quick-look

Regex /refund.*\b([A-Z]{2}\d{6})\b/i matches "refund for order IN123456". Captures the order ID, fires an HTTP request to the OMS, replies with the live status. Three-rule library handles 80% of inbound refund queries without an agent.

EdTech
Case 03

Course menu for institute

Exact match on "COURSES" fires an interactive list with six course categories. Each list option triggers a downstream rule that sends syllabus PDF and a fee structure. Replaces a five-page web form. Adoption jumps because students stay inside WhatsApp.

Healthcare
Case 04

Branch locator for clinic chain

Contains match on city names from a 240-entry list. Reply with branch address, hours, phone number and a Google Maps link. Adding a new branch is a single row in the rule list — no flow edit, no deploy.

Financial Services
Case 05

Stop / unsubscribe compliance

Highest priority rule (priority 1) matches /^(stop|unsubscribe|opt.?out)$/i in any case. Sets opt-in-status to false, sends a confirmation, and excludes the contact from future broadcasts. Audit-logged for DLT and consent compliance.

How it works

From signup to first send in minutes.

Chatbot Rules is included on every SabNode workspace. No separate billing, no extra setup — flip it on from your workspace settings.

  1. 01

    Create a rule

    Pick a matching mode, write the pattern, draft the reply. The editor previews matches against a sample message so you know what fires before saving.

  2. 02

    Set scope and priority

    Restrict to a channel, language, segment or time window. Drag to reorder priority. Conflicts with existing rules are flagged in line.

  3. 03

    Publish and observe

    The rule goes live across all matching channels instantly. The hit counter starts ticking. The debug feed shows the next twenty messages it matched.

  4. 04

    Iterate or escalate

    Refine patterns based on misses. Add escalation if the rule keeps firing for the same contact. Promote high-hit rules into a full Flow if the journey grows.

  5. 05

    Measure deflection

    Flow Analytics rolls up rule hits per channel per day. Compare against shared-inbox volume to quantify the human-hours saved.

Plays well with

Works with the tools you already ship on.

Meta WhatsApp Cloud APIInstagram Graph APIGmailOutlookWeb Chat WidgetShopifyHubSpotSlack
Frequently asked

Questions about Chatbot Rules.

Can't find what you're looking for? Talk to our team.

When should I use a rule versus an AI agent?
Use a rule when the question is closed-ended and the answer is fixed: hours, refund policy, branch list, menu navigation. Use AI when the question is open-ended or needs reasoning over your knowledge base: "does this product work with my existing setup". Rules are faster, cheaper and never hallucinate. AI is more flexible but costs money per call. Most teams end up with 60-80% rules, 20-40% AI.
Can a rule fire a flow instead of replying directly?
Yes. The reply action has three modes: send a message directly, hand off to the shared inbox, or trigger a SabFlow with the captured payload. This lets rules act as cheap intent classifiers — the regex catches the intent, the flow does the heavy lifting. You can also chain rules: the first rule sends a button, the button click matches a downstream rule.
How are regex rules sandboxed?
Every regex is compiled with a 50ms execution timeout and a 10,000-step backtrack limit. Catastrophic patterns (like nested quantifiers) are detected at save time and rejected with a hint. This means a rogue regex cannot stall the message pipeline or DoS your inbound queue.
Do rules respect the WhatsApp 24-hour service window?
Yes. Inside the 24-hour window, rules send free-form messages (cheap, fast). Outside the window, the rule engine automatically degrades to a Send Template action using the template you specified as fallback. If no fallback template is set, the rule logs a "service window expired" event and the conversation routes to the inbox.
Can I bulk import rules from a spreadsheet?
Yes. The rule list has a CSV import with columns for pattern, mode, reply, channel, priority and scope. We use this regularly to migrate teams from Freshchat, Zoko, Interakt and other rule-based bots. The importer validates each row and reports collisions before committing.
How do scoped rules interact with global rules?
Scope narrows the rule's applicability — a rule scoped to "Hindi contacts" only evaluates for contacts where language is Hindi. Within the evaluation set, priority order applies normally. This means a global priority-10 rule still beats a scoped priority-50 rule for English contacts, but for Hindi contacts both compete and priority decides.
Is there a limit on the number of rules?
No hard cap. We have tenants running 2,000+ rules across 14 channels with sub-50ms p99 match latency. The engine indexes rules by channel and scope on save, so adding a rule does not slow down the existing ones. Practical advice: above 200 rules, group them with tags and use the search bar to navigate.
Wachat · Automation

Ship chatbot rules into production this week.

No credit card. No sales call required. Spin up a workspace, plug in a number, and your team is live in under an hour.