Understanding Liquid markup and Zendesk Support

Return to top
Have more questions? Submit a request

94 Comments

  • Simon Blouner
    Community Moderator

    Hey Raman Kalia

    If I understand your case correctly, you should be able to achieve this, like with the following example:

    {% if ticket.latest_public_comment_formatted contains 'specific word also present in KB URL' %}
           https://link_to_very_special_hc_article.zendesk.com/hc
    {% else %}
         Simply leave blank here, or default link. Not advisable if several IF/ELSE sentences are present. Then only         add default link in one IF/ELSE scenario.
    {% endif %}

     

    #helpsome regards,
    Simon Blouner
    Zendesk Consultant @ helphouse.io

    0
  • Raman Kalia

    Hi Simon,

    Thanks for updating the thread!!

    My requirement is bit more than presenting one out of two or more cases. I would like to present all the URLs that have matching words in the ticket's comment. How do we achieve that.

    Thanks,
    Raman

    0
  • Simon Blouner
    Community Moderator

    Hey Raman Kalia
    So, you would like to do a search in your HC/KB, based on the comment submitted by a end-user?

    I'm still not sure if I understand your case, but have you looked at the Knowledge Capture app?

    This app automatically tries to search your Knowledge Base based on the content of the ticket, and you can then link to the most relevant article found.

    If this is not what you're looking for, please get back!

    0
  • Raman Kalia

    Dear Simon,

    Thanks for writing back!

    I do not want to search URLs. Let me rephrase my concern below.

    Scenario 1

    Criteria word - 'Transport'.

    Condition - If comment from the user contains this word, e.g. 'When is my transport getting arranged' or 'what are the timings of monrning transport'.

    Result -

    'Dear user you may also like to explore information on below link with respect to your transport related query'
    URL Link - https://mydomain.com/TransprotQueries (this URL is hardcoded into my script)


    Scenario 2

    Criteria words - 'Transport' and 'Fee'.

    Condition -
    (For 'Transport') If comment from the user contains this word, e.g. 'When is my transport getting arranged' or 'what are the timings of morning transport'.
    (For 'Fee') If comment from the user contains word 'fee', e.g. 'when can I come to submit the fee' or 'What are the free subsidies available'.

    Result -

    'Dear user you may also like to explore information on below link with respect to your transport related query'
    URL Link - https://mydomain.com/TransprotQueries.html (this URL is hard-coded into my script)

    'Dear user you may also like to explore information on below link with respect to your fee related query'
    URL Link - https://mydomain.com/FeeQueries.html (this URL is hard-coded into my script)

    Both above URLs will be hard coded in the script.

    I would like to call as many up to 5 such URL based on 5 different words if they come altogether in same comment from the user.

    Thanks

    Raman

    0
  • Simon Blouner
    Community Moderator

    Hey Raman Kalia

    If I understand you correctly, you would be able to achieve this in two ways:

    1. Create a trigger(s), where you use the condition "Comment" text as either an all or any condition:

    And then add an action with your text to the end user.

    This will, however, I assume, force you to create several triggers.

    2. In my head, you would also be able to solve it in one notification trigger, by using the following example:

    {% assign word = ticket.latest_public_comment | split: " " %}

    {% if word contains 'Transport' and word contains 'Fee' %}
    Some awesome URL about Transport and Fees

    {% elsif word contains 'Busses' %}
    Some awesome URL about Busses

    {% else %}
    Some default text with a URL, or simply blank

    {% endif %}

    Please be aware that I've not tested the above example - it's just written freely from memory. If this is not the solution, I'm afraid I can't assist any further as I'm all out of ideas. :-)

    #helpsome regards,
    Simon Blouner
    Zendesk Consultant @ helphouse.io

     

     

    0
  • Raman Kalia

    Hi Simon,

    Going with option of trigger has some Zendesk challenge, where it no two triggers can have same text criteria. E.g. If I have to put a word combination of 'Transport' and 'Fee' vs. 'Busses' and 'Fee' Zendesk will not provide expected result.

     

    The Liquid Markup code is not firing. It is producing only final text. I.e.  "Some default text with a URL, or simply blank". I tried to find the some solution but seems something is a miss at my end.

     

    Thanks,

    Raman

     

     

    0
  • Simon Blouner
    Community Moderator

    Hey Raman Kalia

    Would it be possible for you to post the current setup you're trying to get to work? 

    Maybe some screenshots and some C/P of your liquid markup statement

    0
  • Amauri Souza

    Hi there,

    is it possible to build a json with all ticket information, using liquid?

    I need to send the ticket information, includ attachments to an external api. I can do it and send basic information, but when I try to loop the comments and get the attachments, the trigger did not work and I don't receive the information in the external api.

    I'm trying to do that with the following code:

    {
    "msg": "{{ticket.title}} received from {{ticket.requester.name}}",
    "comentarios": "{{ticket.comments}}",
    "anexos": [
    {% for comment in ticket.comments %}
    {% if forloop.Last == false %}
    "anexo": "{{comment.attachment}}",
    {% else %}
    "anexo": "{{comment.attachment}}"
    {% endif %}
    {% endfor %}
    ]}
    0
  • Brett Bowser
    Zendesk Community Team

    Hey Amauri,

    It looks like you were able to get an answer to your question here: Using Liquid markup to support multiple languages in automations, macros, and triggers (Professional and Enterprise)

    Let us know if you have any other questions!

    0
  • Stuart Warren

    Is it possible to use liquid markup in Brands signatures? I have set up a brand signature that has markdown to display a hosted image; works great for email but when an SMS is sent there are issues. I have tried adding the following into the brand signature section and it seems to always return else. 

    {% assign tags = ticket.tags | split: " " %}
    {% if tags contains 'outbound_text' %}

    XYZ Support
    P: 1300 000 000
    E: support@xyz.com

    {% else %}

    **{{agent.name}}**
    {{agent.signature}}
    {{agent.phone}}
    support@xyz.com
    [xyz.com](http://xyz.com)

    ![xyz](https://xyz.com/assets/folder/logo.png)

    {% endif %}

    Goal: When an SMS is sent to a customer via a trigger, the brand signature returns the plain text "XYZ Support
    P: 1300 000 000
    E: support@xyz.com".

    0
  • Andreas Schuster
    Community Moderator

    Hi Stuart

    Could you please try the following syntax?

    {% if ticket.tags contains 'outbound_text' %}
    ...
    {% else %}
    ...
    {% endif %}

    This works for me in my own Zendesk account with a similar use-case.

    Cheers,

    0
  • Stuart Warren

    Thanks Andreas Schuster, I have tried that and the signature still gets applied. How have you got the trigger set up for sending SMS messages? The ticket has more than 1 tag on it, do you think that would also contribute to the problem?

    0
  • Andreas Schuster
    Community Moderator

    Hi Stuart,

    Maybe it's an issue with SMS. Unfortunately, my account is not using this feature so I only tried it with an email-ticket.

     

     

     

    As you can see it works on my end. Let me get back to my colleagues in the community.

    Cheers,

    0
  • Stuart Warren

    Hi Andrea, Im trying to apply this logic to the Brands Email Signature section. It might be that the Brands Email Signature section does not support this but ill keep trying different solutions. 

    0
  • Andreas Schuster
    Community Moderator

    At this point it would probably make sense to contact the Zendesk technical support about which fields are supported in the brand signature. It could be the case that ticket data (tags) isn't available there.

    0
  • Daniël Nieuwendijk

    Is it possible to (conditionally) include another macro into the current macro, using Liquid?

    The use case is such, that we re-use the same building blocks of text in many different macros, but they can't be combined into one macro using if statements, because there's a human decision needed.

    If these texts need to be updated, they need to be updated in many macros. It would save work and prevent omissions if I only needed to update them in one place.

    So I would like to be able to do something along the lines of:

    {% if varXYZ == 1 %}
    {{ macros.macroname123.comment_value }}
    {% else %}
    {{ macros.macroname456.comment_value }}
    {% endif %}
    0
  • Sebastiaan Wijchers
    Community Moderator

    Hello Daniël,

    As far as I know that's not possible. Did you consider using 'dynamic content' to achieve what you're after? I think that will do the job in some scenarios.

    With kind regards,

    Sebastiaan
    Sparkly ⭐

    2
  • Daniël Nieuwendijk

    Thanks Sebastiaan! I thought Dynamic Content was only applicable to a multi-language setup, but it reads like it could be applied to my use case. I’ll be sure to look into it further!

    0
  • Stuart Warren

    Zendesk tech support provided me with the following response related to using liquid mark up in brand signatures. 

    I think we found a cause here, though it is unfortunately not going to help get us to the end goal. The issue at hand is that the brand signature CAN use liquid mark up, however in determining the conditions of the if statement it does not reference the ticket object. Meaning that anything in your liquid requesting ticket data will be returned as Null, which counts as false. It then defaults to the else statement.

    The liquid will look at agent ID and Brand ID, but not the ticket.

    I apologize for the limitation here, and wish there was a workaround I could recommend, however it is really not going to be something that could be made to work on the signature. If you made a Macro and included a plain text fallback then that ought to work, but your agents would need to apply this macro to each ticket, rather than relying on liquid in the signature. 

    0
  • Andreas Schuster
    Community Moderator

    Hi Daniël Nieuwendijk,

    Thanks Sebastiaan! I thought Dynamic Content was only applicable to a multi-language setup, but it reads like it could be applied to my use case. I’ll be sure to look into it further!

    Did you already try it out?

    You can definitely nest dynamic content, I was using this already a couple of years ago.

    Cheers,

    0
  • Jameel Boonzaaier

    can someone please help me understanding how liquid markup work.

     

    We have more then one domain we use in our company so on a users response to a client next to the name there is the company name. I spoke to zendesk and they say to use liquid markup to remove it but i dont know how 

     

     

    0
  • Brett Bowser
    Zendesk Community Team

    Hey Jameel,

    Can you provide a screenshot of the company name you're referring to in the email?

    That may help give a better understanding of what you're trying to remove.

    Thanks!

    0
  • Jameel Boonzaaier

    Hi Brett 

     

    in the screenshot below u will see the agent name and next to is the company name ...

    can I remove it 

     

    0
  • Brett Bowser
    Zendesk Community Team

    Hey Jameel,

    This looks like the optional name that is showing up next to your support address. If you navigate to Admin>Channels>Email and select Edit next to your support address, do you see the company name showing in the Name (optional) field?

    Let me know!

    0
  • Jameel Boonzaaier

    Hi Brett

     

    From what i can see its blank

     

    0
  • Brett Bowser
    Zendesk Community Team

    Hey Jameel,

    Thanks for the update!

    Could you navigate to Admin > Channels > Email and disable Personal Email Replies as well as add the following code snippet to your HTML template? 

    Let me know if that doesn't work for you!

    0
  • Daniël Nieuwendijk
    Did you already try it out?

    Andreas Schuster Yes I have. And I can say it works pretty well! I find that I need to pay a bit more attention, but as long as you know what you're doing, test what you did, and don't apply it willy-nilly, it works. At least for me, it does.

    0
  • Donald Cornel

    Hi There!

    Is anyone here have an idea how to capture the previous value of a field (custom field) after it has been changed and updated on a ticket?

    I need to set a notification via a trigger, ONLY once a particular field value has been changed/updated and I need to capture the previous value as well.

    0
  • Raman Kalia

    Hi Donald Cornel,

    I think you can try it by series of triggers. But you will have to keep two fields for the same value here. Let me explain.

    You can keep two custom fields carrying same values. One that is visible on the ticket form and second that is not. So, when you are updating the first field and submit the ticket, a trigger (call it trigger #2) should update the other field as well. But, before updating the second field, run one more trigger (say trigger #1) that will pick the value from second field and update to the ticket.

    Hope this solves your problem.

    Thanks

    0
  • Felipe Vengoechea

    Good morning,

    I am trying to set a Macro that displays a table with the content populated on specific ticket fields. I was able to do so this using Dynamic Content.

    Is there a way, based on the Ticket Form selected, to select which placeholder of the dynamic content to add to the comment?

    This is what I got so far:

    Text added when I run the macro. When updating the ticket, the content will appear.

    0

Please sign in to leave a comment.

Powered by Zendesk