Creating custom rules allows you to target a specific subset of your user base. Using custom rules you can create highly targeted flows to ensure your messages are relevant to your user and the actions they took on your site. 

Here are some examples of how you may want to use custom rules: 

  • Target users who have a cart value over X amount or under X amount.

  • Target users who are visiting your site from a specific country, or using a specific language. You may want to create one flow for English speakers and one for Spanish.

  • Target users who have viewed a specific product. 

If you want to find out how to create your own rules you'll first need to learn where to find the data ShopMessage uses to define rules and how to use that data!

To build your custom rules, you'll want to navigate to the rules tab of your flow and choose the event that will trigger your flow. After you've chosen an event, you'll notice that you can add properties and values to that event's rules. So where do you find this information?

Finding Your Event Properties and Values

Step One
To see what data is available for you to use, first choose an event that will trigger your flow. To do this create a new flow or edit an existing flow. 

Then navigate to the rules tab of your flow and choose the event that will trigger your flow. Then click on save.

The most common rules you will use will be: MessageSent, ViewProduct, QuickReplyThanks, UpdateCart, MessengerOptin, PurchaseComplete

Please note, your data will change based on the event selected. 

Step Two
From the Messages tab click on a pencil icon or edit button to navigate to the message editor.

From within the message editor click on the data tab

Scroll down to Event Data, this is where' you'll find all of the events and event properties that ShopMessage is recording. This is the data that you can create custom rules based on.

How to Read Event Data

ShopMessage uses JSON to identify the events that we're tracking on your site and their properties. 

Within the curly brackets { } is all of the data ShopMessage is tracking about an event. 

Identifying Properties

To identify the properties that you will be able to include in your rules, please look for your Top-level properties, these will be the most left-aligned. 

Nested properties are slightly indented. For now, avoid using nested properties. ShopMessage will be able to identify nested properties in the future. 

In the example below we would choose to create a rule based off of total_price.

We would not choose cart token as this is a unique number and we would not choose items as there are only nested values available. 

Identifying Property Values

All properties are on the left side of the colon in blue and the value of that property is on the right side of that colon in orange or green.

In this example total_price is the property and 36300  is the value.

ShopMessage recognized four types of values: 

  • String: a string always has double or single quotes around it. Example: "Red Boots"  

  • Number: a number is a numerical value without double or single quotes around it. Example: 20000 

  • Boolean: boolean is a true or false value without double or single quotes around it. Example: true 

  • Date: a date is a string in a specific YEAR-MONTH-DATE ("2018-11-17”) format surrounded by double or single quotes. Example: '2018-11-17' 

Using Data to Create Custom Rules

After identifying the properties and values that you would like to use to modify your rules, navigate back to your rules tab.

Then plug in the event, property and value that you've just defined. Here's how:

Please note that you can use this mode for both inclusion and exclusion rules

Testing Your New Flow Rules

To test your new flow, navigate back to your Message timeline and change the first the message in your flow to fire as soon as possible

Next, trigger the event on your site that will fire this flow and ensure that you receive the first message in the flow. 

Please note that this may take up to half an hour to send.

.

Did this answer your question?