Jinja snippets - Get the first user message
This Jinja snippet returns the first user message. It can be helpful to use it as a ticket subject when escalating the conversations. It filters out the system message ConversationCreateEvent
that appears in the Zendesk Messaging channel when the conversation is automatically started by opening the widget.
{# Get the 1st human msg to use as a tkt subject -#}
{% set ns=namespace(first_human_msg="") -%}
{% for m in certainly.transcript if m.from=="human" and m.text!="ConversationCreateEvent" and ns.first_human_msg=="" -%}
{% set ns.first_human_msg = m.text|truncate(60) -%}
{% endfor -%}
{{ ns.first_human_msg }}