Developer User Group - September Meetup: Liquid
Developer User Group is back!
It was great meeting you all last week. We explored Shopify's liquid template language and its implementation in Zendesk which you can use in macros, triggers, automations, dynamic content, custom field titles, and email templates to provide personalised experience and gain more control of your workflows.
We demonstrated basic usage such as assigning variables, using iterations, extracting substrings from Zendesk ticket comments, and so on. We also went through the various language tags and whether they are supported in Zendesk's implementation. We had more content than time, so we decided to continue with part 2 in our October meetup. In this meeting we will share some creative solutions to problems from the community. For example:
- How to reduce the number of triggers for multi-brand instances.
- How to automatically set customer expectations during holidays.
- How to notify a webhook based on attachment file type.
- How to divide work equally among different groups.
- How to customise email templates.
Plus an introduction to simplified email threading. So, make sure you do not miss it. RSVP here.
Resources
- Zendesk Support placeholders reference
- Liquid reference
- Liquid for designers
- SweetHawk's free app to test liquid placeholders
Q&A
Question: Can i use INCREMENT for this? I have a dept that wants to have a Subject that's the format of "Brand"-"ProjectName"-"ProjectNumber". Can we assign an initial starting project number, say 100, and each time someone uses the form, can it increment it so it's now 101, then next time 102, etc? AND... can we do some kind of concatenate to combine a Brand field, a ProjectName field, and the incremental ProjectNumber field together into the Subject?
Answer: While you can use liquid for such simple arithmetic operations on numbers and for string concatenation, you would need a place to store the initial and current values. For example, projects related to an organisation, you can store the latest project number in an organisation custom field and reference it in business rules, or a macro that prefixes the ticket subject. At the same time, you can trigger a webhook to increase the stored value in the organisation custom field.
Question: Can liquid template be used for Guide?
Answer: Guide uses a different template language by Zendesk called Curlybars. It is based on the popular template language Handlebars. Curlybars is well documents in API Reference (recently moved from developer docs).
Recording
Watch on Zendesk's Youtube channel.
Until next time!
-
Thanks to Stephen Belleau for sharing a great tip on one of his use cases:
A fun use case for liquid, we sometimes want to render something if a certain tag is present on a ticket. For example, each ticket will always have a tag that defines SLA and it is always formatted as "bronze_sla" or "silver_sla". So I iterate through the tags and check the last four characters for a match: (whitespaces added for code readability)
{% assign array = ticket.tags | split: " " %}
{%- for tag in array -%}
{%- assign suffix = tag | slice: -4,4 -%}
{%- if suffix == "_sla" -%}
{%- if tag contains "bronze" -%}
Bronze
{%- elsif tag contains "silver" -%}
Silver
{%- elsif tag contains "gold" -%}
Gold
{%- elsif tag contains platinum -%}
Platinum
{%- endif -%}
{%- endif -%}
{%- endfor %}
サインインしてコメントを残してください。
1 コメント