Using Liquid in your Signatures

Last Updated -

Overview

Desk's signature feature allows you to use HTML, but what if you wanted to customize it further and use Liquid? You can use Liquid in the Email Reply theme to display a custom signature on a per Agent basis or a different signature to show depending on the case type or status.
 

Setting up a Custom Signature on a Per Agent Basis

If you want to control the Agent's signature rather than allowing each Agent to set their own, you'll want to follow the steps below.

Note: Implementing the steps below will no longer display the signature you have set in Admin > Team > Users > Signature or in the signature Settings of the Classic Agent.

Step 1: You'll need to know the Public Name of the Agent. This is located at Admin > Team > Users in each of the users' profile:

 
Step 2: Once you know the agent's public names, you would want to create a custom Reply Theme or edit your existing Reply Theme. You do this at Admin > Channels > Email > Reply Themes > Your Theme.

Step 3: Open your Reply Theme and find the following code
{% if email.agent.signature %}
<div style="margin-top:10px;"> {{email.agent.signature | newline_to_br}}</div>
{% endif %}

Step 4: Delete it, and replace it with this sample code:
{% case email.agent.name_public %} 

{% when 'Martha Stewart' %} 
{% if forloop.first %}
<br/><b>Martha Stewart</b><br/>
Customer WOW Specialist<br/>
<img src="http://www.gravatar.com/avatar/06ad581d10608cc16d32cb7b9952b29d.png" alt="Martha"> 
{% endif %}
{% when 'Agent 2 public name here' %}
Insert Agent 2 Signature Here
{% when 'Agent 3 public name here' %}
Insert Agent 3 Signature Here
{% else %} 
{% if forloop.first %}

<br/><b>Desk.com Support</b><br/>
Phone: 877-226-9212<br/><br/>
<a href=<"http://www.desk.com">Desk.com</a>

{% endif %}
{% endcase %}

You would create a different "When" statement for each agents public name, you can have as many as you want. The  "Else" at the end is optional to be used if you want to have a generic signature in the event that there were no matches.


Showing a Signature Based on Case Status

If you wanted a specific signature or part of a signature to show based on the case status, this is how. In this example we'll be showing you how to show the agent specific signature but amend it based on the case status.

Step 1: Go to Admin > Channels > Email > Reply Themes > Your Theme

Step 2: Look for this bit of code:
{% if email.agent.signature %}
<div style="margin-top:10px;"> {{email.agent.signature | newline_to_br}}</div>
{% endif %}


​Step 3: Add something like this before or after it:​

{% if case.status.name == “Resolved” }
ADD YOUR EXTRA BIT HERE
{ endif %}
With that code you'll only be showing what's in-between the if/endif statements when a case is "Resolved". You can set that to Pending or to Open as well. That way if you have a survey for example it would only show when a case is at a specific status.