Using Liquid Markup to A/B Test Your Triggers

21 Commentaires

  • Christopher Stock
    Community Moderator

    This is great - thanks for sharing Lance!

  • Brett Bowser
    Zendesk Community Manager

    I agree with Chris! This is awesome :)

    Thanks Lance!

  • McCabe Tonna

    I agree with everyone above - this is great

  • McCabe Tonna

    I'm getting a

    {"error":"Unprocessable Entity","message":"Server could not parse JSON"}


    Any insight?


    also it's an HTTP target not HTML target.. i assume thats correct

  • Kaloyan Todorov

    Excellent Write up Lance!

    Not only about the clever tip but also of your writing style and engaging information delivery.

  • Heather Rommel
    Community Moderator
    The Product Manager Whisperer - 2021

    I can't wait to try this. Fantastic tip!

  • Ash



    I am getting the following issue. can someone help ?



  • Lance Conzett

    @... Good question! You can ignore that error message, the JSON target is trying to validate your code as JavaScript rather than Liquid. As long as the JavaScript between the {% when %} lines is valid, you're good.

  • Chris DiGiacomo


    I'm having some trouble getting this to add additional tags.


    When creating the HTTP target, I replace subdomain with my own subdomain, correct?{{}}

    It may be that I am not enabling basic authentication - is that required?

  • Lance Conzett

    @... Yes, you'll replace the subdomain with your own ZD subdomain. And you do need to enable auth and enter your username and password in order to pass an API call to Zendesk that updates a ticket.

  • Chris DiGiacomo

    Thank you @...

    I enabled auth - how will I know that the API call is passed? Will successful sends update on the extensions page?

    I'm still not getting additional tags on created tickets. Maybe it is because I'm using google connector to authenticate?

  • Ash

    @... - Thanks for this great info, But now i seem to be having the same issue as @... above.

    See his post here





  • Lance Conzett

    @... @... Sounds like you might have some special characters in your JSON body. That's particularly common when using something like Notepad that changes your quotation marks to curly quotes (rather than straight quotes).

    I'd recommend reviewing the characters in your JSON and adjusting as needed.

  • Arthur Mori

    @... is correct, the Unprocessable Entity error was caused by a malformed JSON. It seems the copy and pasting of the JSON example from this article replaced the quotation marks with 

    instead of

  • mccabe.tonna
    Community Moderator

    It should be HTTP target, not HTML

    Great write up been using this for years


  • Dave Dyson

    Thanks @...! Lance has updated his article.

  • Kuldeep Patidar

    Hi All,

    I'm trying to establish an integration between two Zendesk instances, however I get the following error.


    POST /api/v2/tickets.json HTTP/1.1


    {"error":"Unprocessable Entity","message":"Server could not parse JSON"}

    Below is what I sent in API request:

    {% case %}
    {% when standard_group_id %}
    {% assign group = 'secure_group_id' %}
    {% else %}
    {% assign group = '' %}
    {% endcase %}
    "subject": "{{ticket.title}}",
    "group_id": {{group}},
    "comment": {
    "body": "{{ticket.comments_formatted}}"
    "requester": "{{}}",
    "tags": [
    "custom_fields": [{"id": escalated_by_id, "value": "{{}}"}]

    Can anyone please help me?



  • Austin Killey
    Zendesk Customer Care

    Hey there @...!

    I'd be happy to take a look with you with that payload.  A few different things standing out from what I can see:

    • I'm assuming that the secure_group_id string is something you've added just as a placeholder for your public comment here, so as long as your payload itself is including valid group IDs in your conditions like {% when 12345 %}, then feel free to ignore this bullet point!
    • For your else statement: If you set the value of your group variable to be blank or only single quotes, that may lead to the unprocessable entity errors you've been running into, as your payload will need a group ID entered in order for it to be accepted.  Depending on your workflow needs, you could try setting a fallback group ID for your group variable whenever its else statement returns true, like {% assign group = %}.  
    • For your custom fields object, we'll want to set the values of custom fields by listing their field IDs rather than their field names (since field names can change at any time while a field ID will be permanent).

    Since you mentioned setting up an integration between 2 Zendesk instances though: How would you feel about skipping this HTTP target-based workflow altogether, and instead setting up a ticket sharing agreement using our guide here?

    Ticket sharing would allow you to get pretty close to the payload setup you're currently using, and you could also sync custom field data from one Zendesk instance to another.  You could also build out trigger conditions and actions to automatically share certain tickets with the other Zendesk instance using a trigger's "Share ticket with" action, worth a look!

  • Kuldeep Patidar

    Hi @...,

    Thank you for your answer.

    I apologize for having responded late. I'm wondering if you could create a support ticket so that we can have a discussion about the alternative.

    Looking forward to hearing back!

  • Leonardo Vizioli

    Hi all,

    Thanks for the tip Lance! Amazing.

    However, when testing the extension I keep getting HTTP/1.1 401 Unathourized

    I am using my e-mail/token as username and my newly generated token as password.

    Am I correct in assuming that I should leave the JSON body blank when creating the HTTP target and that the request is PUT with the URL written exactly like this:{{}}

    Or should I replace {{}} with a ticket id?

    All help is much appreciated

  • Chris Stewart

    Hi Lance Conzett

    Maybe this is you, maybe not - But I came across this article elsewhere that seems to have lifted your content word for word -


Vous devez vous connecter pour laisser un commentaire.

Réalisé par Zendesk