How to dynamically customize Slack notifications based on Ticket Status or Priority

2 コメント

  • Eitan Blumin
    コメントアクション Permalink

    I eventually managed to implement this on my own (more or less) after I learned some Liquid Markup basics and realized that it's case and language sensitive...

    I came up with the following JSON payload that works decently (at least for English language, anyway):

    {
    "attachments":
    [
    {
    "pretext": "{{ticket.status}} {{ticket.ticket_type}} update by *{{current_user.name}}*:",
    "fallback": "{{ticket.status}} {{ticket.ticket_type}} #{{ticket.id}} has been updated at {{ticket.updated_at_with_time}}",
    "author_name": "Ticket #{{ticket.id}} [{{ticket.organization.name}}] via {{ticket.via}}",
    "title": "{{ticket.title}}",
    "title_link": "{{ticket.link}}",
    "footer": "Status: {{ticket.status}} | Priority: {{ticket.priority}} | {{ticket.updated_at_with_time}}",
    "footer_icon": "https://slack-events.zendesk-integrations.com/assets/images/badge-status-{{ticket.status | downcase}}.png",
    "color": "{% case ticket.priority %}{% when 'Low' %}#9fc6c6{% when 'Normal' %}#F09000{% else %}#D00000{% endcase %}",
    "text": "*{{dc.requester}}:* {{ticket.requester.name}}\n*{{dc.assignee}}:* {{ticket.assignee.name}} \n{{ticket.latest_comment}}"
    }
    ]
    }

     

    See attached screenshot for how these notifications look like in Slack.

    0
  • Danny Koss
    コメントアクション Permalink

    Super helpful, thank you.

    I'm trying to change the color based on whether the last comment was public or private.  I have the following, but it's not quite right...

    "color": "{% if comment.is_public == true %}#269ecb{% else %}#ffe2b3{% endif %}",

    Any suggestions?

    0

ログインしてコメントを残してください。

Powered by Zendesk