What are Rules and Its Components?
  • 28 Oct 2022
  • 12 Minutes To Read
  • PDF

What are Rules and Its Components?

  • PDF

Rules can help you manage and automate frequent activities by triggering a response or action when a Conversation meets just the right conditions.

With Rules, you can:

  • Send an auto-reply to Customers whenever an email comes in.
  • Add Topic(s) to a Conversation.
  • Route a message with the word "Returns" to a specific Inbox.
  • Reassign a Conversation or Task that has become overdue
  • + more!

Rules allow you to automate manual processes for your team and help your team be extra efficient. With the time you save, you can focus more on making your Customers happy.

Components of a Rule

There are three main components to a Rule:

  1. Trigger
  2. Condition(s)
  3. Action(s)

Rules are executed When a defined Trigger is detected, And Condition(s) are met, Then Actions are taken, which complete a Rule.

1. Trigger

Trigger is an event that sets the wheels in motion for a Rule. Each Trigger may have additional qualifiers that need to be selected. 

The following Triggers and qualifiers are available to use in Rules:

TriggerQualifiersDescription 
Agent status changes toAway, OfflineWhen the Agent who is currently assigned the Conversation goes Away or logs out, including when this happens because the Agent has been idle.
  • Only applies to Conversations currently assigned to an Agent.
Assigned Task due date isDue in X minutes, Overdue, Overdue by X minutesWhen a Task assigned to an Agent passes a certain threshold relative to the due date, Administrators can set that threshold to be before or after the due date, depending on your goals. This Trigger is re-evaluated every minute.
Conversation due date isDue in X minutes, Overdue, Overdue by X minutesWhen a Conversation passes a certain threshold relative to the due date—Administrators can set that threshold to be before or after the due date, depending on your goals. This Trigger is re-evaluated every minute. The due date is determined by the SLA.
  • Does not apply to Conversations without a due date (e.g., Waiting or Closed status)
Communication is receivedn/aWhenever a call or message is received from a Customer or 3rd party, regardless of Channel.
Topics addedn/aWhen a Topic or set of Topics is added to the Conversation.
  • Use with Topics Condition.
Answer usedn/aWhen a message is sent using an Answer.
  • Does not apply to Notes.

2. Condition(s)

Condition narrows down the set of Triggered events that the Rule will act on. A Rule can have no Conditions, 1 Condition, or several. Some Conditions are only relevant for specific Triggers, and so the list of options may vary. 

The following Conditions are available to use in Rules:

ConditionQualifiersDescription
First Messagen/a
  • Appears as "Message initiates a conversation."
  • Refers to whether an inbound message is the first in a Conversation.
  • This Condition does not apply to the first message sent when a Conversation is reopened.
New Contactn/aRefers to whether an inbound message is the first in a Contact.
ChannelChat, Email, Facebook Messenger, Instagram Messaging,  Phone Call,  SMS, Twitter, Voicemail, WhatsAppRefers to the Channel of the most recent Customer communication. 
Channel Typen/aRefers to a group of Channels rather than specifying individual Channels. "Messaging" includes Chat, SMS, Facebook Messenger, Twitter, WhatsApp. "Mail" includes Email, and Voicemail.
Message FromContains, Does Not Contain - Any, Only, ReExRefers to the person who sent the message. For example, this could be an email address, phone number, or Twitter handle.
  • This Condition does not apply to Chat.
Message ToContains, Does Not Contain - Any, Only, RegExRefers to the address that received the Message. For emails, this does not include CC'ed or BCC'ed recipients.
  • This Condition does not apply to Chat.
Message SubjectContains, Does Not Contain - Any, Only, RegExRefers to the subject line of an Email. This Condition does not apply to other channels or Tasks.
Message BodyContains, Does Not Contain - Any, Only, RegExRefers to the main content of the message, or in the case of Tasks, the Task's main content. This Condition does not apply to Phone Calls, or Voicemails.
Assignment StatusAgent, InboxRefers to whether a Conversation is currently assigned to an Inbox (also referred to as "unassigned") or to an Agent.
Dedicated HeroAssigned, Not AssignedRefers to whether the Customer has a Dedicated Hero assigned or not.
InboxIncludes, ExcludesRefers to the Inbox the Conversation is currently in.
Agent StatusAway, OfflineRefers to the status (Away or Logged out) of the Agent who's assigned to the Conversation.
Due dateDue In, Overdue, Overdue ByRefers to whether the due date is at or beyond a certain threshold. This applies to both Conversation due dates and Task due dates.
TopicsAny Of, All Of
  • Refers to the Topics assigned to the Conversation. The "All of" Condition is met if all selected Topics are present, while the "Any of" Condition is met if at least 1 selected Topic is present. Topics need to be already applied to the Conversation.
  • For the "Topics added" Trigger, this Condition refers to the Topics being added at that time and not Topics added before the triggering event. U se the "Topics" Condition when you use the "Topics added" Trigger unless you want to Trigger the behavior for every Topic that's added.
AnswerAnswer name, Language, ChannelRefers to the Answer used in a message that was sent. At least one qualifier should be selected. For example, you can choose an Answer name without specifying the Language, or vice versa.
URLContains, Does Not ContainRefers to the URL where chat was initiated through Sidekick.
Proactive ChatCampaign SelectionRefers to a specific Proactive Chat Campaign.
Business HoursBusiness Hours NameRefers to the Business Hours on hours Customers can expect a response.
Custom Attributes Number
  1. Is, Is not
  2.  Between, Equal to, Greater than, Greater or equal, Less than, Less or equal
Tailored to the custom attributes you have set for Customers. If available, these Conditions appear at the bottom of the list of standard Conditions.
Custom Attributes Currency
  1. Is, Is not
  2. Between, Equal to, Greater than, Greater or equal, Less than, Less or equal
Tailored to the custom attributes you have set for Customers. If available, these Conditions appear at the bottom of the list of standard Conditions.
  • Supported currency Conditions use ISO 4217 codes.

Custom Attributes String
  1. Contains, Does Not Contain
  2. Any, Only, RegEx
  • Tailored to the custom attributes you have set for Customers. If available, these Conditions appear at the bottom of the list of standard Conditions.


Note - Custom attributes may not be available when Rules execute
Rules are executed in parallel with a custom attribute lookup. This means a Rule may execute but we cannot guarantee the Rule will have the latest custom attribute value in the Rule. In many cases, Rules will run and complete before a lookup completes. This is due to a lookup making a call to an external system that cannot provide any latency guarantee in Gladly, so Gladly prioritizes inbound Contact routing instead of lookup data.

Multiple Conditions

You can achieve even more granularity in your Rules by adding multiple "And" Conditions. Each Condition you add is a logical "And" statement. For example, if you create a Rule with "Message Subject" and "Channel," the Rule will only execute if both "Message Subject" and "Channel" Conditions are met. 

Inclusions and Exclusions

Certain Conditions use "Includes" and "Excludes" as an additional qualifier where "Includes" means the selected items must be met for the Condition to apply. "Excludes" means that the Condition can be fulfilled by excluding any selected items.

"All of" and "Any of"

"All of" means every item specified must be there to qualify (logical "AND"). "Any of" means only one of the items specified needs to be there to qualify (logical "OR").

Text Matching

Some of the Conditions above look for matching text to determine whether the Condition is met. These "text matching" Conditions follow very similar patterns that are helpful to understand.

Whether the content contains or does not contain the provided text allows you to target based on your requirements. 

The type of text matching — Any, Only, RegEx, or Words — is an important distinction.

Match Text ConditionDescription
Any
  • The text you're searching for can appear anywhere in the content being searched and does not have to be the only text. For example, the phrase "Happy Birthday" appears in the content "Happy Birthday to you!" and would be matched using Any
  • Use quotation marks for longer text to bound a word or sentence.

Note – Watch out for potential implications of using this Condition. For example, if a Rule is configured to move messages that contain "exchange" to a particular Inbox, the word "change" could also trigger the Rule to execute. Think about using Words (more below) to create exact matches of distinctive words you wish to add.

Only
  • The text you're searching for must match exactly with the content. Except for leading and trailing spaces, the content must be precisely the same, with nothing more or less. This matching type is most useful for matching email addresses, custom attribute values, and predictable text like automated email subject lines. For example, the phrase "Happy Birthday" would not match the content "Happy Birthday to you!" using Only because the text strings don't precisely match.
  • Multiple phrases cant be matched using Only. For example: "hello, re:hello" will search for "hello, re: hello" and not "hello" or "re: hello."
RegExShort for Regular Expression, a form of light coding which lets you match patterns in the text without specifying the entire string. This is particularly useful to distinguish words that can be part of other words, like "log" and "catalog," or to match phrases that may have variable text. For example, by using RegEx, "Happy .* to you!" would be matched to "Happy Birthday to you!", "Happy New Year to you!" and "Happy to send the receipt to you!". 
  • For example, to ensure the word “exchange” is not associated with the word “change,” a RegEx would look like: \bchange\b
    • For multiple words, you'll need to incorporate parentheses and a pipe separator. It would be as follows: \bchange\b|\bhell\b|\god\b.
  • Check out examples of how to use Regex and how to work with RegEx. If you still need assistance, we suggest working with a developer or engineer.
  • RegEx matching follows Google's re2 library.
  • To check your regular expression, you can use a service like Rubular.
WordsWordsallow you to create text-matching Rules that look for whole words (or multi-word phrases) that might sometimes be a part of another word. You can provide a comma-separated list of words or multi-word phrases when setting up a Condition. Whatever is placed between the commas (except leading and trailing spaces) will be searched for, but only found if it’s a complete word, and not if it appears within another word.
  • For example, the words “all”, “ask”, and “bask” are contained within the word “basketball”, but if you’re only looking for the word “ask”, and don’t want the Rule to trigger when “basketball” comes up, then choose Words rather than Any. You can also use RegEx to detect whole words, but sometimes the RegEx encoding can be tricky, so this allows for a simpler, more predictable setup.
Tip - Text Matching
  • Use commas can separate search terms. This allows you to put multiple search terms in the same Condition. Only 1 match is needed for the Condition to be met because these are treated as logical "OR" statements.
  • Search terms can be case-sensitive or not, depending on your selection.

Number Comparison Operators

Some attributes may introduce numerical values as an identifier. And with the use of comparison operators (Between, Equal to, Greater than, Greater or equal, Less than, Less or equal), these numerical values can be used for automation. For example, let's say you have a custom attribute called "Loyalty Points" which is used to track the accumulated lifetime loyalty points of a Customer, and you want to route Customers with 1,000,000 points or more to your VIP Inbox, then the Condition could look like: If Loyalty Points is Greater than or equal to 1,000,000.

Note - Attributes support
Number and Currency attributes currently support only US formatting for use of commas and periods for Rules evaluation. Commas are considered for the delineation of thousands, millions, etc. Periods are considered for the delineation of decimals.

Numbers not formatted in this way can still be displayed in the Customer Profile.


Comparison OperatorDescription
BetweenThe value received from the attribute is greater than or equal to the first value entered, and less than or equal to the second value entered.
Enter the lower of the two values in the first entry field, and the higher value in the second field.
Equal toThe value received from the attribute is equal to the value entered.
Greater thanThe value received from the attribute is greater than the value entered.
Greater or equalThe value received from the attribute is at least equal to or greater than the value entered.
Less thanThe value received from the attribute is less than the value entered.
Less or equalThe value received from the attribute is at least equal or less than the value entered.

Number and Currency attributes provide the same operators; however, with Currency attributes, you will need to select the currency type expected. Using the currency type selected, Rules will extract either currency symbols or 3-letter ISO codes that appear before the number, which is then evaluated like a number.

For example, if you have a rule that says If Total Spent is greater than 400 USD, these formats of the total spent will succeed: "$500", "USD 500". However, formats with the code or symbol appearing after the number will not succeed: "500 USD", "500 $".

ISO CodeCurrency NameSymbols Supported
AUDAustralian dollarAUD, A$
BRLBrazilian realBRL, R$
CADCanadian dollarCAD, CA$
CHFSwiss francCHF
CNYChinese yuanCNY, CN¥
DKKDanish kroneDKK
EUREuroEUR, €
GBPPound sterlingGBP, £
HKDHong Kong dollarHKD, HK$
IDRIndonesian rupiahIDR
INRIndian rupeeINR, ₹
JPYJapanese yenJPY, ¥
KRWSouth Korean wonKRW, ₩
MXNMexican pesoMXN, MX$
NOKNorwegian kroneNOK
NZDNew Zealand dollarNZD, NZ$
PLNPolish złotyPLN
RUBRussian rubleRUB
SARSaudi riyalSAR
SEKSwedish krona/kronorSEK
TRYTurkish liraTRY
TWDNew Taiwan dollarTWD, NT$
USDUnited States dollarUSD, $
ZARSouth African randZAR

3. Action(s)

Action determines what will happen if the Conditions are met for a given Trigger. Each Rule must have at least 1 Action, and you can add multiple Actions.

The following Actions are available to use in Rules:

ActionsDescription
Assign to AgentAssigns the Conversation to the designated Agent.
  • Only the first Rule assigning an Agent will apply. Any other Rules containing Agent assignment as an Action will be ignored.
Assign to InboxAssigns the Conversation to the selected Inbox.
  • Only the first Rule assigning an Inbox will apply. Any other Rules containing assign to Inbox as an Action will be ignored.
Unassign from AgentRemoves the currently assigned Agent, which reassigns the Conversation to the Inbox it is in.
Add TopicsAdds the selected Topic(s). This action does not apply to Tasks.
  • Other Rules that assign Topics can apply to a single Conversation. Topics will continue to be added to each Conversation as directed by each Rule.
Mark No Reply NeededMarks the Contact as "No Reply Needed," which fulfills the SLA (where applicable) and moves the Conversation to the "Waiting" state but does not close it.
Create a TaskCreates a Task with a configurable due date that can be assigned to an Inbox or Agent.
  • Use for Communication is received, or Topics added Triggers only.
Close ConversationCloses the Conversation, which fulfills the SLA (where applicable).
Send Auto-ReplySends a message to the Customer on the specified Channel using the selected Answer.
  • Applies to all Messaging Channels and Email.
  • If an Email Answer with an attachment is used as an auto-reply, the attachment is ignored.
  • Applies to the same Channel (Messaging or Email) where the message was received.
  • Answer Channel reflects the variation of the Answer text.
  • Only the first Rule sending an auto-reply will apply. Any other Rules containing a send auto-reply Action will be ignored.
Close TaskCloses the Task.
  • Use for Assigned Task Due Date Trigger only.
  • Only applies to Tasks that are assigned to Agents.



Was this article helpful?