Productivity Tips - Rules, Macros, Liquid Variables, and Regular Expression

Last Updated -

Here at Desk, we are hyperfocused on efficiency and productivity. Why do we care so much? Because we're passionate about our customers. These types of skills have three main benefits:
  1. Efficient agents can solve more cases per hour, meaning your customers get responses faster.
  2. Efficient rules can help you respond to customers and organize Desk without your agents clicking a button.
  3. Efficient teams help you grow your organization at your own pace.
In this article, we'll walk through the following: 
  • Our four main tools that fuel productivity 
  • What is regular expression & how can it expand the power of rules?
  • Automatically sending password reset instructions based on a customer's email
  • Setting up a macro that asks for specific information
  • Setting fields in Desk based on information in a customer's message
  • Using a multi-step macro to support business processes 
  • Making a field required

Ready? Let's go! 

We have four main tools that help us get efficient: Rules, Macros, Liquid Variables, and Regular Expression.

Rules evaluate a case for conditions, and then when a case meets those conditions, it performs one or more actions. Rules are set up ahead of time, and require no human interaction.

Macros are also created ahead of time, but are used by an agent while working on a case, or multiple cases, to perform a series of preset actions. A macro can do four main things:
  • Insert pre-written ('canned') text, speeding up an agent's reply time by removing the need to type out common replies.
  • Insert private case notes for other agents that the customer does not see
  • Modify field values
  • Modify labels
Liquid Variables allow you to provide customized support, at scale. These variables allow you to, for example, insert a customer's name into a response without having to look it up.

Regular expression, or RegEX, is a parsing language that extends the power of rules. In a nutshell, you provide a set of characters or a pattern of text, and regular expression looks for that text, or text that matches your pattern and pulls it out. This is helpful in a number contexts in programming and software. For our purposes, we can use it to scan customer messages for specific keywords or numbers.

Helpful Links to learn more about our rules We'd like to demonstrate how to use these rules with an example scenarios.

Scenario 1: How to Automate a Response to Frequently Asked Question (3 Tasks)

You run support for Brian’s Bikes, which has a customer community. People frequently forget their passwords and need help resetting. We want to set up the fastest way possible to provide those customers with the help they need, preferably without agent interaction. Next, we want to set our agents up with a quick way to ask for more information if it’s needed and lastly, when that information returns from the customer, we want to record their username into a custom field in their customer record.

Task 1: Setup a workflow such that users who email your support center, and mention 'password' automatically get sent an email with password reset instructions

First, we'll need to create an auto-acknowledgment with the reset instructions. In the admin panel, click on channels, email, and then auto-acknowledgment, and then 'Add Theme.' To keep any branding, or html elements in your email, you will need to edit the HTML theme. If that's not a possibility, you can toggle on the text only option and then edit that section at the bottom of the page.

In our case, we're going to insert the reset instructions, as well as a liquid variable so that the email addresses the customer by name. Here's how that looks:

Next, we're going to create a rule to actually send it. In the admin panel, click on cases at the top of the page, and then rules on the left hand side. We want to evaluate the emails that come in from customers, so click on inbound interaction.

We're going to add two conditions in the 'all section.' We'll choose case status is new, and last auto-acknowledgement sent greater than 1 hour ago. This ensures that we're only evaluating brand new cases, and that we don't send a given customer too many emails.

In the any conditions section, we're going to add 'interaction subject' and 'interaction body.' In the text box, paste this regular expression: [PpAaSsWwOoRrDd]{8}. That string tells desk that we want to identify 8 characters, in a row, that are found in the word password, either capital or lowercase. Without this regular expression, we'd have to add an any condition for any possible interaction of spelling and capitalization of 'password.' This will send the auto-acknowledgment no-matter if your customer wrote password, Password, or even Passsrod.

Important: You need to click the box that says 'use regular expression.' Otherwise, Desk will only try to match the literal text we've put in the box.

Then, under actions, choose to 'send auto-acknowledgment' and chose the one we just created. Then, add an action for setting case status to resolved, because we hope that this has solved the issue for the customer.

Here's a screenshot of the final rule:

Task 2: If a customer needs additional help after receiving the reset steps, help your agents respond faster by setting up a macro.
Customers often need additional help getting back into their Brian's Bikes account. To verify their identity, we need to ask for four key pieces of information and escalate the case to our Tier 2 team. To do that, we'll create a macro.

In the admin panel, click on cases at the top of the page, and then macros on the left hand side. Click create new macro, and call it 'Password Reset - Additional information.'

In the screen that pops up, make the following edits:
  • Folder: Placing macros in folders help agents move faster by making it easier to find the macro they need. Create a folder or create a new folder.
  • Set case status to pending, since we'll be waiting on some information from the customer
  • Use the group assignment option to assign to your escalation team
  • Set the case contact reason to 'password reset.'
Lastly, add this quick reply. Note the use of a liquid variable to personalize the interaction:

Hello {{customer.first_name}},
I'm sorry to hear that you're still unable to get into your account. To provide access to your account, we'll need to verify your identity. To do so, we'll need the following information:

First Name:
Last Name:
Last 4 digits of your Credit Card:

Please provide this information, and we will work hard to help you regain access to your account.

And now, by using the macro, our agents can move our customer to the next step faster, while updating a number of section in the case.

Task 3)
Now we’re waiting on the customer for the information. Once they respond, however, it’s still a time consuming process to verify their identity. Our escalation team will have to scan the email looking for the customer's information. What if, instead of having to scroll through the case to find the customer’s user name, we could pull it out of the email with a rule and stick it in a custom field?

First, we'll need to create another inbound interaction, as again, we we want to evaluate emails as they come in from the customer. In the admin panel, click on cases at the top of the page, and then rules on the left hand side. Call your new rule, 'Set Username.'

On this particular rule, we're not actually going to have any conditions because. For actions, we want to fill a custom field on the Customer Object called 'username,' which I've already set up. We'll look for the rule action of 'Set Customer Username,' which creates a an empty field.

The next we paste into that field is going to be a combination of liquid variables and regular expression. Here it is:
{{ email_in.body | scan: 'Username: (.*)' }}

If we take a look at that text, we see that this rule is going to scan the body of the email, looking for the string 'Username: ' and then we want to pull out whatever follows that and place it in our custom field.

To summarize, once these tools are set up, if a customer emails in and mentions password, even if they misspell it, we'll send them steps to regain access. If the customer still needs help, our agents have a one click option to provide information, escalate the case, and track contact reason. Lastly, when the customer responds, a rule automatically picks up an important piece of information and places it in a custom field.

Scenario 2 - How to Get Customer Information, Faster (Two Tasks)

You run support for a mobile app company. When a customer has an issue with the app, you need to find out their platform, and help the customer retrieve a log from the app so your agents can diagnose the issue. Lastly, because you want to know which platforms your engineering team should prioritize, you will create a custom field called 'platform' and you'll make it required.

Task 1 - Create a process involving two separate macros to help the customer provide their app's log

Finding the log is different on every platform, and we don’t want to just put the steps for every platform in the email, because I don’t want to confuse the customer. So first, I'll create a macro to help our agent quickly ask for the customer's platform.

In the admin panel, click on cases at the top of the page, and then macros on the left hand side. Click create new macro, and call it 'Data Log 1 - Need Platform.'

In the macro options, set the following:
  • Place the macro in a folder, or create a new folder
  • Set case status to pending, since we'll be waiting on some information from the customer. When the customer replies to the case, Desk will open the case back up.
  • Add the following text as your quick reply:

Hello {{customer.first_name}}, 

I'm sorry to hear you're having an issue. To help you resolve this, I'll need to know which platform (iOS, Android, etc) you’re currently using?

You'd then create an additional macro for each platform. In this case, the customer said they were using iOS, so we'll take a look at that macro. In the admin panel, create an additional macro, similar the one we just made in this case, choose the following options:
  • Call the macro Data Log 2 - iOS
  • Place the macro in a folder, or create a new folder
  • Set case status to pending, since we'll be waiting on some information from the customer. When the customer replies to the case, Desk will open the case back up.
  • Add the following text as your quick reply:

Hello {customer.first_name}},

Thank you for that information. On iOS, you'll want to tap the 'hamburger' icon in the top left of the app, tap settings, and then tap data log. Copy that text and paste it in your reply. I look forward to resolving the issue once we get that log.

Now your agents can follow multi-step processes correctly each time using a series of macros.

Task 2: Make a field required with a case updated rule

After we get the log, we want to make sure that agent fills out the platform field so we can begin tracking bugs by platform. We'll do this with a case updated rule, because we'd like desk to evaluate a case each time a case is updated.

In the admin panel, click on cases at the top of the page, and then rules on the left hand side. Click Case Updated, and then create a new rule. Choose the following options:
  • Call the rule 'Platform Rule - Required.'
  • Add an 'all' condition for 'case status is resolved. This is because we want to stop the case from being resolved without this field.
  • Add an additional 'all' condition for 'Case Platform is -' and then leave the value blank, because that's what we're concerned about.
  • Then add an action to set case status to open, this will ensure you can't resolve a case with this field empty.
  • Add an additional action to append a label called 'Platform Field Required.' This will help the agent to understand why the case has reopened.
You can make multiple fields required with a single rule by moving the blank field to an any condition, and adding additional any conditions for each field. You'd also need to change the label to 'Required field is blank.'

In summation, we're working through multi-step processes faster, and as an administrator, you can make sure your agents are collecting important information.