Taking triggers to the next level
This is intended to be read after reading the guide: Automatically attach to a Problem ticket on created/updated
Important: This is not a guide and is an example of what the previous post is capable of.
You will need advanced knowledge of liquid markup and be familiar with Dynamic content to work with the below code
So you've realised that there is so much more potential to the "JSON Update" extension you made in the previous guide. Maybe you are looking for ways to create dynamic first responses, or maybe directly target customers who have purchased something?
Here are some of the things I tackle in the following code:
- Identify known issues (custom field) and use Dynamic content to send the first response to the customer (you can have as many issues as you like).
- Send purchase instructions if they have had a purchase issue.
- As customer to provide their ID number to locate their account.
- Ask the customer to be more clear if their ticket description has a low word count.
- Automatically assign to a problem ticket.
- set the status of the ticket
- Send troubleshooting steps if all else fails.
Example Dynamic content
Our dynamic content is carefully named to be detected by the below JSON Update.
For example: "TAG: device_not_compatible" evaluates to the placeholder {{dc.tag_device_not_compatible}} which is important for the known issue code (ie. ki_tag, ki_ttile, new_ki, etc...)
public:true,
status:hold,
type:incident,
problem_id:123456,
~
This issue has been identified and is still being investigated.
To read more about this issue, refer to the [Help Center Article Example](https://support.zendesk.com)
We will let you know as soon as we have any updates.
Example JSON Update
We have triggers set up that add various tags such as "inc_social", "purchase", etc...
{% comment %} ASSIGN SOME VARIABLES {% endcomment %}
{% assign break = "
" %}
{% assign paragraph = "
" %}
{% assign public_comment = true %}
{% capture pre %}{{ticket.requester.name}}, {{ticket.description | date: "%b %d, "}}{% endcapture %}
{% assign word_count = ticket.description | remove:pre | remove:'-' | strip | split:' ' | size | minus:1 %}
{% comment %} WORK WITH SPECIFIC FIELDS {% endcomment %}
{% if ticket.ticket_field_option_title_21043339 == 'Fancy Field 1' %}
{% assign ki_tag = ticket.ticket_field_26978517 %}
{% assign ki_title = ticket.ticket_field_option_title_26978517 %}
{% elsif ticket.ticket_field_option_title_21043339 == 'Fancy Field 2' %}
{% assign ki_tag = ticket.ticket_field_27068747 %}
{% assign ki_title = ticket.ticket_field_option_title_27068747 %}
{% elsif ticket.ticket_field_option_title_21043339 == 'fancy Field 3' %}
{% assign ki_tag = ticket.ticket_field_25955257 %}
{% assign ki_title = ticket.ticket_field_option_title_25955257 %}
{% unless ticket.ticket_field_option_title_29363077 contains dc.update_version %}
{% assign latest_version = dc.update_version %}
{% endunless %}
{% endif %}
{% capture ki_dc %}tag_{{ ki_tag }}{% endcapture %}
{% capture dc_tag %}dc_{{ ki_tag }}{% endcapture %}
{% comment %} CHECK WHAT DC HAS ALREADY BEEN USED {% endcomment %}
{% unless ticket.tags contains dc_tag %}{% assign new_ki = true %}{% endunless %}
{% unless ticket.tags contains 'dc_purch' %}{% assign new_purchase = true %}{% endunless %}
{% unless ticket.tags contains 'dc_ts' %}{% assign new_troubleshooting = true %}{% endunless %}
{% unless ticket.tags contains 'first_response' %}{% assign first_response = true %}{% endunless %}
{% unless ticket.tags contains 'dc_update' %}{% assign new_update = true %}{% endunless %}
{% comment %} BUILD MESSAGE CONTENT {% endcomment %}
{% if first_response %}
{% assign greeting = 'Thank you for contacting Support. We appreciate you taking the time to write to us.' | prepend:paragraph %}
{% assign new_tags = new_tags | append:'first_response,' %}
{% endif %}
{% if dc[ki_dc] and new_ki %}
{% assign body = dc[ki_dc] | split:'~' %}
{% assign settings = body[0] | split:',' %}
{% assign content = content | append:paragraph | append:'### ' | append: ki_title | append:'?' | append:break | append:body[1] %}
{% assign new_tags = new_tags | append:"dc_" | append:ki_tag | append:',' %}
{% elsif ticket.tags contains "purchase" and new_purchase %}
{% assign body = dc.tag_purchase | split:'~' %}
{% assign settings = body[0] | split:',' %}
{% assign content = content | append:paragraph | append:'### App store purchase issue?' | append:break | append:body[1] %}
{% assign new_tags = new_tags | append:'dc_purch,' %}
{% elsif new_troubleshooting %}
{% if word_count < 6 and first_response %}
{% assign greeting = dc.unclear_request | prepend:paragraph %}
{% assign settings = 'status:pending' | split:',' %}
{% endif %}
{% assign content = content | append:paragraph | append:'### Have you tried troubleshooting?' | append:break | append:dc.troubleshooting %}
{% assign new_tags = new_tags | append:'dc_ts,' %}
{% endif %}
{% if latest_version and new_update %}
{% assign new_tags = new_tags | append:'dc_update,' %}
{% assign content = content | append:paragraph | append:"### Your client may need an update" | append:break | append:dc.update_check %}
{% endif %}
{% unless ticket.tags contains 'inc_social' %}
{% assign new_tags = new_tags | append:'inc_social,' %}
{% assign content = content | append:paragraph | append:'### Help us locate your account' | append:break | append:'If we can\'t find you, we may not be able to assist. Please make sure you have included your Player ID.' | append:break | append:dc.player_id %}
{% endunless %}
{% comment %} UPDATE TICKET {% endcomment %}
{% if content %}
{
"ticket": {
"id": {{ticket.id}},
"tags":"{{ticket.tags | replace:' ',',' | append:',' | append:new_tags | append:'bot_update'}}",
{% for setting in settings %}
{% assign val = setting | strip | split:':' %}
{% if val contains "public" %}
{% assign public_comment = {{val[1]}} %}
{% else %}
"{{val[0]}}": "{{val[1]}}",
{% endif %}
{% endfor %}
"comment": {
"public": {{ public_comment }},
"body": "{{ dc.hi }}{{ greeting }}{{ content }}"
}
}
}
{% else %}
{
"ticket": {
"id": {{ticket.id}},
"comment": {
"public": false,
"body": "We can't find a valid reason for updating this ticket."
}
}
}
{% endif %}
Please sign in to leave a comment.
0 Comments