Reference
Rules and recipes

Angel Cheung
Angel Cheung
  • Updated

In this article, you'll learn how to use rules, recipes, and custom regex patterns to manage customer replies in the Conversation Node and Inbound SMS Trigger node. These tools help you set up conditions for accepted replies, such as emails, mobile numbers, or specific keywords.

Key concepts

Rules are specific conditions that a message must meet to trigger a response. These conditions can be based on the content of the message, such as keywords, phrases, or patterns.

Recipes are predefined sets of rules designed to match common patterns such as email addresses, phone numbers and more. They simplify the process of setting up common reply scenarios.

Within Pendula, you can use Preview & test to send test messages and verify if the message matches the rule set.

Rules

  • Go to the node where you want to add a rule.
  • Provide a label for the path to clearly identify the purpose of this rule set.
  • Click on Add Rule to begin the rule creation process.
  • From the dropdown menu, select the type of rule you want to create. For example, you can choose "Contains (anywhere within)".
  • Input the specific value that the rule will match in the Value field. For example, enter "promo" to match any message containing the substring "promo".
  • To create more complex matching criteria, click Add rule or Add recipe to include additional rules. This allows you to build comprehensive conditions for matching inbound messages.
  • Use the Preview & test to send test messages and verify if the message matches the rule set. If the message matches, it turns green.
Rule Type Description Example
Contains (anywhere within) The received message must contain the specified word. The match is case in-sensitive, and even with additional characters attached, the word will still be matched. Rule: Contains (anywhere within) "promo"
    Matches: "Get the promo now!"
    Does Not Match: "Promotions are here!"
Contains (whole word) The received message must contain the specified word exactly. The match is case in-sensitive, however cannot contain additional characters attached to the word. Rule: Contains (whole word) "yes"
    Matches: "Yes, please!"
    Does Not Match: "yesss"
Is exactly The received message must match the case-insensitive value letter-for-letter without additional characters such as exclamation marks or emojis. Rule: Is exactly "STOP"
    Matches: "stop"
    Does Not Match: "stop now"
Is exactly (case sensitive) The received message must match the case-sensitive value letter-for-letter without additional characters such as exclamation marks or emojis. Rule: Is exactly (case sensitive) "Hello"
    Matches: "Hello"
    Does Not Match: "hello"
Starts with The received message must begin with the specified sequence of characters. Rule: Starts with "Buy"
    Matches: "Buy now!"
    Does Not Match: "Please buy now!"
Ends with The received message must end with the specified sequence of characters. Rule: Ends with "thanks" 
    Matches: "Many thanks"
   

Does Not Match: "Thanks for everything"

Using emojis

When you are creating reply matching rule with emojis, we recommend using only the Contains (anywhere) rule type, and the default emoji variation to ensure all skin tone variations are matched.

For example:

- "Contains (anywhere) "πŸ‘" will match to any reply containing **any** of these variations: πŸ‘ πŸ‘πŸ» πŸ‘πŸΌ πŸ‘πŸ½πŸ‘πŸΎ πŸ‘πŸΏ".
- "Contains (anywhere) "πŸ‘πŸΎ" will only match replies containing "πŸ‘πŸΎ". All other skin tone variations will not be matched.

To consider: Apple and Android message reactions

Apple and Android devices allow users the ability to 'react' to a message. These reactions are received by Pendula as valid replies and will be matched accordingly. You can use the rule Starts with and the value of the react type (e.g. Loved "), for each device type, to cater for these replies.

Reaction Device Reply received by Pendula
Apple Loved "[Original SMS]"
Apple Liked "[Original SMS]"
Apple Disliked "[Original SMS]"
Apple Laughed at "[Original SMS]"
Apple Emphasised "[Original SMS]"
Apple Questioned "[Original SMS]"
Android β€Šβ€‹β€οΈβ€‹ to 'β€Š[Original SMS]'
Android β€Šβ€‹πŸ‘β€‹ to 'β€Šβ€Š[Original SMS]'
  Android β€Šβ€‹πŸ‘Žβ€‹ to 'β€Šβ€Š[Original SMS]'
Android β€Šβ€‹πŸ˜‚β€‹ to 'β€Šβ€Š[Original SMS]'
Android β€Šβ€‹β€ΌοΈβ€‹ to 'β€Šβ€Š[Original SMS]'
  Android ❓​ to 'β€Šβ€Š[Original SMS]'

Recipes

A recipe is a pre-written rule. You can browse and add a recipe by selecting "Add recipe". Below are examples of what is and isn't accepted according to the recipes.

Recipe Replies are matched to this rule if it...  Matched examples Unmatched examples
Email address Contains an email address – a username, followed by @ symbol, a domain name and top-level domain (e.g. "com", "org"). harry@hatman.com,

My email is harry@hatman.com
(The email itself can be extracted with β€˜matchedPart’ mergefield)
@hatman.com
Mobile no. (AU) Contains a valid Australian mobile number. A reply can start with 04, 614,+61 0400000000, +61400000000, 61400000000

My mobile number is 61400000000

(The mobile number itself can be extracted with β€˜matchedPart’ mergefield)

04000
Mobile no. (UK) Contains a valid UK mobile number. A reply can start with 0, 44,+44and can be proceeded with 4-10 digits. 07890 111111, +4400000000, 4400000000  
Number

Contains standalone numbers, without accompanying words or alphabet characters.

Includes decimal numbers and integers, but not negative numbers.

1, 3.14, 1000000 -1, I give this a 10/10, 1,000,000
No Contains  "no", "nope", or "nah" as standalone words. no thanks, nah... nothx, decline, πŸ‘ŽπŸΌ
Yes Contains "yeah", "yep", or "yes" as standalone words. yes!, yeah nah yespls, yesπŸ‘πŸΌ, πŸ‘πŸΌ
Opt-out Exactly matches (non case-sensitive) Stop, stopall, unsubscribe, cancel, end or quit, STOP, CaNcEL Please stop sending me messages , UNSUBSCRIBE!
Opt-in Exactly matches (non case-sensitive) Start, Unstop Start, unstoP Start sending me messages again , unstop?

Using mergefields

Mergefields allow you to dynamically reference parts of a matched message in subsequent workflow steps. This is particularly useful for creating personalised responses and handling data dynamically.- Access the matched part of the message using the mergefield explorer. For example, the mergefield 'MatchedPart' (a 'string') can be used to reference the exact part of the message that triggered the match.

If a customer replies with an email address that matches a recipe, you can reference this email address later in your workflow to send a confirmation email or update a customer record.

Adding multiple rules and recipes

You can add multiple rules and recipes to a single path, allowing for flexible and comprehensive reply matching. This enables you to handle various types of customer replies efficiently.

When a message matches any rule or recipe in a path, it will follow that path. The relationship between each rule and recipe is "OR," meaning that if a reply matches at least one of the rules, it will be matched to that path.

How does reply matching work?

Reply matching operates based on specific rules for determining which path a message will follow:

  • If a reply matches multiple paths within the same node, the path positioned highest in the node's configuration will be matched.

  • If a reply matches rules across different active experiences, the reply will be matched to the customer's most recent conversation. Consider Annie, who is in two marketing flows that both listen for the keyword UPGRADE. The first offer is sent at 8 am, and the second at 9 am. When she replies with UPGRADE, her reply is matched to the second flow since it is the most recent interaction.