Se sai come usare i segnaposto in Zendesk Support, hai già una certa conoscenza di Liquid markup, ovvero il linguaggio di modellazione che usiamo per abilitarli. I segnaposto vengono usati nelle automazioni, nelle macro, nei trigger e nei widget come contenitori di dati utente e ticket generati dinamicamente. Ciò che forse non sai a proposito di Liquid markup è che puoi usarlo anche per personalizzare il modo in cui questi dati vengono selezionati e visualizzati come output. Questo perché Liquid consente di creare una logica di programmazione semplice come istruzioni case, istruzioni if, cicli for e così via.
Scrivendo semplici istruzioni di controllo direttamente nell’azione commento/descrizione nelle macro e nell’azione email dell’utente nelle automazioni e nei trigger dei ticket, puoi eseguire in un’unica automazione, macro o attivare ciò che dovevi fare in più automazioni, macro e trigger. Puoi anche personalizzare la presentazione del testo dei commenti. Questa opzione non è supportata per i trigger di messaggistica.
La documentazione di Liquid è disponibile nella pagina Liquid for Designers, che contiene una descrizione dettagliata di tutti gli elementi del linguaggio. Una breve descrizione del funzionamento del linguaggio è comunque esposta di seguito.
Liquid è un linguaggio di modellazione per il rendering di email e HTML. È il meccanismo che consente l’inserimento automatico di dati in commenti e notifiche email mediante l’uso di segnaposto.
- Output, ovvero output di testo racchiuso tra parentesi graffe doppie.
- Tag, che contengono la logica di programmazione che determina il modo in cui i dati vengono espressi con segnaposto.
Se assimili output e segnaposto, sei sulla buona strada per capire cosa sia Liquid e come viene usato. Tuttavia, ciò che forse non sai riguardo l’output di Liquid è che oltre a esprimere dati utente e ticket, esistono metodi che consentono di manipolare array e stringhe di testo. In Liquid, questi metodi sono denominati filtri. Usando un filtro, ad esempio, puoi trasformare il testo in caratteri maiuscoli. Ma questo è uno degli esempi più semplici di come possono essere usati i filtri. Consulta la documentazione di Liquid per maggiori informazioni.
Per comprendere perfettamente come usare Liquid, è necessario sapere cosa sono i tag e come vengono usati. I tag forniscono la logica di programmazione che puoi usare per selezionare e presentare i dati.
Usando i tag Liquid puoi creare:
- Istruzioni if else
- Istruzioni case
- Cicli for
- Cicli
- Assegnazioni di variabili
Per altri esempi d’uso di Liquid markup, consulta i seguenti articoli:
- Uso di Liquid markup per supportare più lingue in automazioni, macro e trigger
- Modifica di un trigger di ticket per restituire una risposta in base all’orario di attività
- Uso di Liquid markup per personalizzare la formattazione e l’inserimento di testo in commenti e notifiche email
- Come posso formattare i segnaposto con markup liquido?
Avvertenza sulla traduzione: questo articolo è stato tradotto usando un software di traduzione automatizzata per fornire una comprensione di base del contenuto. È stato fatto tutto il possibile per fornire una traduzione accurata, tuttavia Zendesk non garantisce l'accuratezza della traduzione.
Per qualsiasi dubbio sull'accuratezza delle informazioni contenute nell'articolo tradotto, fai riferimento alla versione inglese dell'articolo come versione ufficiale.
65 commenti
Rafael Santos
1900216093524 , I'd use the
PUT /api/v2/tickets/{ticket_id}/tags
endpoint instead ofPUT /api/v2/tickets/update_many
, as the latter creates a background job, which may be rate limited to 30 concurrent jobs for the entire instance.You could use the Add Tags endpoint, as mentioned above, with a payload such as the following:
As for your other question:
The following trigger conditions could help you exclude this from firing on follow-up tickets with the tags:
Of course, it'll depend on your specific use case. You could also try iterating over the
{{ticket.tags}}
placeholder and use Liquid'scontains
.2
Andy F.
Hi Zendesk community! I have a question about using Liquid Markup with Zendesk ticket tags. I've set up A/B testing in our instance (as described in this article: https://ro.roca.work/blog/ab-testing-in-zendesk) and so far, it's mostly been working for us. However, I just identified a scenario that I can't figure out how to solve.
To summarize, every ticket that is created gets assigned either the control or experiment tag. The problem occurs only sometimes with tickets created as followups, as it's possible for a ticket to carry over the previous tags, like control, but then get assigned the experiment tag by the webhook. How would I use liquid markup in this JSON response to tell it not to fire if a ticket already has the control or experiment tag?
{% assign randomizer = ticket.id | modulo:2 %}
{% case randomizer %}
{% when 0 %}
{“ticket”: {“additional_tags”:[“control”]}}
{% when 1 %}
{“ticket”: {“additional_tags”:[“experiment”]}}
{% endcase %}
Thanks in advance for the help!
0
Dainne Kiara Lucena-Laxamana
Hi Oliver!
Greg one of our developers created a workflow guide here that could serve helpful. Hope it helps!
0
Oliver Atkinson
Hello,
Is it possible to change requesters based on the ticket subject using a combination of triggers and liquid markup/webhooks?
I'd use a webhook + automation combination but ideally, we'd need the requester to change immediately rather than wait the 1-hour increment.
The use case is so we don't have to manually change requesters from a no-reply address.
It's trying to create a solution to this question. Any assistance would be greatly appreciated!
0
Mike DR
You're most welcome and have an awesome day ahead too!
0
Hannah Lucid
1263082264889 I had a feeling that would be the case. I looked EVERYWHERE for something. Thank you for your confirmation Mike!! Have a great day.
0
Mike DR
Did a thorough search on this and didn't see a liquid mark up here for highlights: Liquid for Designers.
0
Hannah Lucid
Hello,
Is there a way to highlight text using liquid markup? We want to highlight text in our Macros to help callout important information to our end-users (if they read nothing else, at least they'll read this). Is this possible? If so, how?
0
Carmelo Rigatuso
1264020519590
When I try that, I get no errors when saving my trigger, but I get an error in the email notification:
BUT!!! double-quotes fixes it!
{% if {{ticket.ticket_field_123}} < "3000.00" %}
{{ticket.ticket_field_123}} is LESS THAN $3000.
{% endif %}
{% if {{ticket.ticket_field_123}} > "3000.00" %}
{{ticket.ticket_field_123}} is greater than $3000.
{% endif %}
Wow, that was a wild ride, thanks for the inspiration ;) I can't believe I didn't think of trying that yesterday.
1
Walter
Hi Carmelo,
It looks like the number is being treated as a string.
Try this instead.
{% if {{ticket.ticket_field_123}} < 3000.00 %}
{{ticket.ticket_field_123}} is less than $3000.
{% endif %}
0
Accedi per aggiungere un commento.