Using Liquid Markup to A/B Test Your Triggers

21 Comments

  • Christopher Stock
    Community Moderator

    This is great - thanks for sharing Lance!

    0
  • Brett Bowser
    Zendesk Community Manager

    I agree with Chris! This is awesome :)

    Thanks Lance!

    0
  • McCabe Tonna

    I agree with everyone above - this is great

    0
  • 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

    0
  • Kaloyan Todorov

    Excellent Write up Lance!

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

    0
  • Heather Rommel
    Community Moderator
    The Product Manager Whisperer - 2021

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

    0
  • Ash

    Hello,

     

    I am getting the following issue. can someone help ?

     

     

    0
  • 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.

    0
  • 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?
    https://subdomain.zendesk.com/api/v2/tickets/update_many.json?ids={{ticket.id}}


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


    0
  • 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.

    0
  • 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?

    0
  • Ash

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

    See his post here

     

    Thanks

    Ash

     

    0
  • 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.

    0
  • 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

    "
    0
  • mccabe.tonna
    Community Moderator

    It should be HTTP target, not HTML

    Great write up been using this for years

     

    0
  • Dave Dyson
    Zendesk Community Manager

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

    0
  • Kuldeep Patidar

    Hi All,

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

    Request:

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

    Response:

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

    Below is what I sent in API request:

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

    Can anyone please help me?

    Regards,

    Kuldeep

    0
  • 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 = ticket.group.id %}.  
    • 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!

    0
  • 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!

    0
  • 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: https://subdomain.zendesk.com/api/v2/tickets/update_many.json?ids={{ticket.id}}

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

    All help is much appreciated

    0
  • Chris S.

    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 - https://roca.work/blog/ab-testing-in-zendesk

    0

Please sign in to leave a comment.

Powered by Zendesk