Prioritize emails based on dates included within an email using Smart Rules

Edited

Overview

Use a Smart Rule to prioritize conversations based on dates found in the email subject or message body. In this example, we’ll show you how to create a rule for a travel use case, tagging active trips as urgent. Once set up, you can also build additional routing rules as needed.


Part 1: Create dynamic variables

To accomplish this workflow, you’ll need to create three dynamic variables. This article assumes you know how to create Smart Rules and dynamic variables.

Dynamic variable #1: Travel date

Create a new dynamic variable called Travel date. This dynamic variable will extract the travel date from the body of a message.

Step 1

Under the “Extract message property” section, select Message body. You also have the option to select Subject if you want to search within the subject instead.

Step 2

Click Add a step. Under the “Extract” section, select Extract text. Use the plus (+) icon to add Digits placeholders.

Step 3

Click Add a step. Under the “Parse” section, select Parse as Date/Time and select Custom format in the dropdown. Enter the custom format as yyyy-MM-dd.

Step 4

Click Save. Your finished variable will look like the following:

Dynamic variable #2: 2 days before travel date

Create a new dynamic variable called 2 days before travel date. This dynamic variable will define the time frame for flagging bookings relative to the travel date. For example, if you want to treat any booking within 2 days of the travel date as "active," configure the variable to flag all dates that fall within that 2-day window.

Step 5

Under the “Use value” section, select Use result of variable and select the Travel date variable you previously created.

Step 6

Click Add a step. Under the “Transform” section, select Subtract and enter “2” into the text field.

Step 7

Click Save. Your finished variable will look like the following:

Dynamic variable #3: Message date

Create a new dynamic variable called Message date. This dynamic variable will store the timestamp of the inbound message. The message date will also be used to compare against the travel date to ensure the message isn’t referencing a past booking.

Step 8

Under the “Properties” section, select Date.

Step 9

Click Save. Your finished variable will look like the following:


Part 2: Create Smart Rule

Now that you have the dynamic variables you need, you can build out the rule. 

When: 

  • Inbound message is received

If:

  • Conversation is in [specific inbox] AND

  • Dynamic variable [Message date] is after [2 days before travel date] AND

  • Dynamic variable [Travel date] is after [Message date]

Then:

  • Add tag [Urgent]

The rule will check if an inbound message is within 2 days of the travel date, and if the travel date is after the message date. This ensures we don't flag old bookings.

Given the above conditions are met, an Urgent tag is added to the conversation for better visibility in your shared inbox. The Urgent tag can then be used for routing to a priority inbox or for viewing all conversations with this tag.

Your finished rule will look like the following:


Pricing

This feature is available on the Enterprise plan. Some legacy plans may have access.