Rules, recipes and custom regex patterns

Angel Cheung
Angel Cheung
  • Updated

Quick links

Using rules, recipes and custom regex patterns

Build your own rules

Recipes

Using custom regex

 

Rules, recipes and custom regex patterns are used in the Conversation Node and Inbound SMS Trigger node to handle any kind of reply your customers might reply with. In general, these are best used for setting up accepted replies with certain conditions (e.g. emails, mobile numbers or 'contains X').

 

Using rules, recipes and custom regex patterns

You can add multiple rules and recipes to a path. Learn more about Reply Matching and best practices when building out flows. 

Depending on your rule, if a message is matched, it can be referenced in later nodes using the mergefield explorer. 'MatchedPart' (a 'string') can be used in this instance.

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

If a reply matches several paths, the topmost path or rule will always be matched.

If a reply matches several rules across different active experiences, the reply will be matched with the customer's most recent Conversation

For example, Annie is in two marketing flows which are both listening for the exact keyword UPGRADE. The offer from Flow One is sent at 8am, and the offer from Flow Two is sent at 9am. She replies with UPGRADE. Annie's reply is matched to Flow Two, because it is the most recent flow experience listening to UPGRADE.

 

Build your own rules

Rules allow you to configure what each path in a node should be listening for. 

To add a rule, select Add rule. Select a rule type and enter a single value. Select "Add rule" or "Add recipe" to add an additional rules. Remember to test your replies to ensure anticipated replies are correctly matched to a path. 

Using emojis in the Build your own rules feature

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.

 

Rule type Description
Contains (anywhere) 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. 
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. 
Is exactly The received message must match the case-insensitive value letter-for-letter without additional characters such as exclamation marks or emojis. 
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. 
Starts with The received message must begin with the specified sequence of characters.
Ends with The received message must end with the specified sequence of characters.

 

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 custom regex (advanced users only)

Craft your workflow using custom regex patterns that suit your needs. To access custom regex input, kindly reach out to the Pendula team for assistance.

Custom regex is designed for flexibility – regex validation will not be imposed.

 

To convert a rule or recipe to regex:

  1. In the Replies tab of the Conversation Node, locate the rule you wish to convert.
  2. Click on the ellipsis and select Convert regex.
  3. Edit the regex pattern as desired.

To write a new regex rule:

  1. In the Replies tab of the Conversation node, create a new Expected Reply path.
  2. Click on the ellipsis of a rule and select Convert regex.
  3. Enter your custom regex pattern as desired.