Recent searches
No recent searches
CSAT, Slack Notifications, and Liquid Markup: How to randomize your CSAT notifications!
Posted May 19, 2020
The Problem
You want agents to be excited about their CSAT. So you set up a Slack channel, and everything's going great. But something's missing. The Webhook responses all look really robotic, right? AGENT A RECEIVED GOOD FEEDBACK ON TICKET 123. AGENT B RECEIVED GOOD FEEDBACK ON TICKET 456.
A lot of organizations use Slack to display their CSAT to their agents, which is a pretty useful tool, but one thing that is pretty bland is that the messaging template is pretty static. So let’s change it up!
The Solution
I will preface this by saying this is a little bit of an advanced Zendesk workflow, and requires a little bit of elbow grease, but it's really cool, and you get to learn Liquid Markup, which can be super useful in Zendesk!
Liquid Markup is a templating language that Zendesk supports, and it’s used to load dynamic information in places where you otherwise wouldn’t be able to. We’re going to be using Liquid Markup today to do something pretty exciting CSAT randomization!
Quick Overview of the Solution
To give you a quick rundown of what we’re going to do here: We’re going to use Liquid Markup in a trigger to have Zendesk randomly apply a specific tag (from a set value of tags) to a ticket when the ticket has been updated with a Good CSAT from the customer. When the tag is applied, another trigger will fire based on the tag used, and the Slack incoming webhook will post to your channel with that custom CSAT comment!
There will be two HTML targets used in this example, one for the Liquid Markup update, and one for the Slack Incoming Webhook update.
You will need to create one trigger to fire the Liquid Markup update specifically when the CSAT is added, and you will need a trigger for each tag/custom comment you will want to use for this setup. In this example, I will be using 3 tags (so 3 triggers).
With all of that out of the way, you’re going to start with the following:
Step 1: Create an HTML Target
Before you start building anything, you need to create an HTML Target that points back to your own Zendesk account.
- Navigate to Admin > Extensions.
- Create a new HTML Target extension.
- Enter https://subdomain.zendesk.com/api/v2/tickets/update_many.json?ids={{ticket.id}} as your URL (edit the subdomain and enter yours)
- Select PUT as the target method.
- Select JSON as the content type.
- Add your username and password (or API token, by entering your username like this example: ‘email@example.com/token’) to the Basic Authentication section, then click Save.
Warning here: if the user whose username and password/API token you're using to authenticate this request leaves the company or otherwise has their Zendesk access deactivated, your target will stop working.
We’re using the “tickets/update_many” endpoint here, rather than the regular tickets endpoint. The reason for that is because we'll be adding tags to the ticket, which requires the update_many endpoint.
Step 2: If you haven’t already, create another HTML Target for your Slack Incoming Webhook
Create a Slack incoming webhook using the channel you want to send the notifications to. You’ll be using the webhook specifically in your triggers once the tag has been added so that a trigger target update can occur. We’ll get to that in a little bit, but you’ll want to make sure that this target is set up correctly:
Setup the target to integrate with the created incoming webhook URL from Slack.
- Title: A descriptive title
- URL: use previously created incoming webhook’s URL
- Method: POST
- Content Type: JSON
- Basic Authentication: not necessary
Step 3: Let’s get kraken’ with some Liquid Markup and get these CSAT comments randomized with a new Trigger.
First, name your trigger something helpful for your admin needs, so you’ll know how/when to update it when you want to add more random comments.
Next, let’s set the conditions for your trigger. You’re going to use the “Meet ALL of the following conditions” section and apply these:
- Status is Solved
- Satisfaction is Good with Comment (You can also use Greater Than Bad with Comment if you want to include ALL good CSATs)
- Tags contains none of the following: csat1, csat2, csat3 (you can use any unique tags here, but the point is to include the number of tags and unique identifiers for the amount of random tags we’ll be adding, so that we don’t have a looping trigger). This will ensure this trigger only ever runs once on this ticket, when the CSAT is applied.
The Actions section is very important, and you’ll want to make sure you follow this next part pretty carefully. Select Notify target, and select your first target, which we will be using to have Zendesk assign a random value to a ticket, and apply that value’s tag to it. Here’s what you’ll put in the JSON body:
{% assign randomizer = ticket.id | modulo:3 %}
{% case randomizer %}
{% when 0 %}
{"ticket": {"additional_tags":["csat1"]}}
{% when 1 %}
{"ticket": {"additional_tags":["csat2"]}}
{% when 2 %}
{"ticket": {"additional_tags":["csat3"]}}
{% endcase %}
Note: Please make sure if you are copy and pasting the above JSON that your “”s are not copied as special characters in your JSON payload. They need to be straight quotes, not curly ones!
Press Save on your Trigger, and don’t worry about the error message, as the JSON target doesn’t know that you’re using Liquid rather than JavaScript to update the ticket.
Let’s break down what the above is doing:
We’re using the Randomizer to assign a random number value to the new Good CSAT ticket. We’ve specified modulo:3 to tell the Randomizer that there are three possible values for it to create, so if you want more options, you’ll want to adjust this to a higher number.
When Randomizer settles on 0, we’re calling that ticket and adding a tag using the additional_tags endpoint -- this can be named anything you want, but here is where I have used csat1. When Randomizer settles on 1, we’re calling that and adding an csat2 tag to the tags using the additional_tags endpoint. It’s completely random what Zendesk will choose, but this Liquid markup means that it will always be different.
We’re almost there!
Step 4: Adding your "Behavior Triggers" (Which will Pass tthe JSON Payloads to Slack)
The last step we need to do is the following: Create triggers that will fire when your csat1, csat2, or csat3 tags (or whatever you name them!) are added to the tickets!
Your triggers can be fairly simple, since you’ve already confirmed and know that the tickets that will have these tags on them will be good CSAT tickets, so you only really need the following:
Under “ALL” Conditions:
- Tags contains at least one of the following: csat1 (you will need to Clone your Trigger for each tag)
- Tags contains none of the following: csat-done (this can also be something of your own too, and I’ll explain why it’s needed at the end below)
Just as before, the Actions section is super important! You’ll want to again select Notify Target but this time, you’ll select the second target, the Slack Webhook target. For this, I won’t provide specifics on how to send in your JSON body, as there are many different ways, I will only provide an example using Slack's attachments, but you’ll want to ensure the text you’re placing in this JSON body is unique and custom for each Trigger.
Here’s an example JSON body I used:
{
"attachments": [
{
"color": "#36a64f",
"pretext": ":emojihere: *{{ticket.assignee.name}}*, BLOODY BRILLIANT! Harry Potter would be proud!",
"author_name": "{{ticket.requester.name}}",
"title": "{{ticket.id}}",
"title_link": "https://subdomain.zendesk.com/agent/tickets/{{ticket.id}}",
"text": "{{satisfaction.current_comment}}"
}
]
}
The pretext in the above JSON body is what should be changed.
You’ll also want to include in the ACTIONS section an “Add tags” and apply the csat-done tag here as well, to ensure the CSAT incoming webhook is only sent to your Slack once as well! Press Save and you’re done with that one!
Once you’re done with that first tagged trigger, you can easily Clone it, and adjust the text for the next one, and the next one, etc.
And then you and your agents can sit back and enjoy this delightful and seemingly random CSAT comments and emojis (go overboard with the emojis!), like the example below:
Really cool, right?
Liquid Markup is super awesome for many other use cases in Zendesk, such as with A/B testing of your triggers, and changing up email template text for autoresponses, so let me know if you want some more tips on how to make your help desk seem a bit more… alive!
Thanks for your time! Let me know if you have any questions!
Documentation/Community Posts used for this Tip
Understanding Liquid markup and Zendesk Support
https://support.zendesk.com/hc/en-us/articles/203662146
Using Liquid Markup to A/B Test your Triggers
https://support.zendesk.com/hc/en-us/community/posts/360029308674
Send notifications to Slack
https://support.zendesk.com/hc/en-us/community/posts/115000388987
0
2 comments
Andrei Kamarouski
Great tip! Added to my favorites! :)
0
Nicole Saunders
Thanks for taking the time to write this tip, Joe! Look for a thank-you note from us in your email later today. :)
0