Recent searches
No recent searches
Tip: How to add conditionals to your Zendesk email template to use custom HTML layouts
Posted Apr 06, 2021
How to add conditionals to your Zendesk email template to use custom HTML layouts
Zendesk level: Intermediate
Knowledge: Liquid, HTML, Email Template Editing, Trigger Template Editing
Time Required: 10 minutes
Documentation, customizations, and troubleshooting on GitHub: https://github.com/Ajhad1/Zendesk-Customizations/tree/main/email/How-to-add-conditionals-to-your-Zendesk-email-template-to-use-custom-HTML-layouts
Where we came from https://support.zendesk.com/hc/en-us/community/posts/1260802142170/comments/1260802990209
Use Case:
Many companies have different departments and different languages and other differences between their many support tickets. A great way to help customers understand/notice the differences is to create different branding based on any of these factors. For example, creating a heading that updates based on the specific group a customer is dealing with.
How it works (simplified):
An invisible HTML element is added to each trigger that allows for parsing at the email template level.
How to Use It:
Pass whatever data needed for the conditional. Modify the conditional to search for whatever data is required.
Prerequisites:
- You must be using Zendesk Support.
- You must have edit access to the email template.
- You must have edit access to the triggers.
How to Install:
- Add code to the respective location. GitHub
- Modify conditional based on your needs.
- That's it.
Explanation:
In this example, I am passing the {{ticket.tags}} in the invisible "div" and then escaping the {{content}} and then creating an array by parsing the {{content}} using a space as a delimiter.
This allows for a conditional to check for specific tags in the {{content}} without having the recipient seeing them.
Notes:
- There is plenty of things that can be done to avoid false positives. The first that comes to mind is only running the conditional on the invisible "div"
- This is more of a proof of concept than anything else.
- This does work as is but there may be issues with false positives.
- If anyone would like to add some validation or other code improvements, I have no issue with updating the article to reflect.
1
0 comments