Too much detail in Slack when a ticket arrives, and not the right detail.

22 コメント

  • コメントアクション Permalink

    Hi Jeremy,

    The json code looks ok to me and should, as far as I can tell, output the ticket id, update timestamp and the requester organization name.

    There is an alternative placeholder for ticket organization you may want to try instead: {{ticket.requester.organization.name}}, but they should do exactly the same.

    Is it possible that your tests haven't had an organization set when the trigger fires (at ticket creation presumably)?

    As for formatting Slack messages, they have a great tool for that.

    Hope that helps you out.

    0
  • Jeremy Heath
    コメントアクション Permalink

    Ok from chopping that code in the builder about i ended up with this

    {
    "text": "A new ticket has been created \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
    "channel": "CCWP86WGZ"
    }

     

    Whats the channel bit for? is it the name where it should appear?

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

    Hi Jeremy,

    I believe that the Channel bit is to specify which Slack channel the message should be sent to - unfortunately, I don't have a working Zendesk-Slack setup at the moment.

    It also occurs to me that there are several ways to send notifications from Zendesk to Slack:

    I believe that my example used the latter, so there may be differences in the setup.

    Hope that helps you out.

    0
  • Jeremy Heath
    コメントアクション Permalink

    Can i get away with just adding it to the slack trigger?

    Just this bit

    {
    "text": "A new ticket has been created \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
    "channel": "CAUQUSVFT"
    }

    0
  • Jeremy Heath
    コメントアクション Permalink

    I tested this and it doesnt work, still comes up without the Org

    {
    "ticket_id": "{{ticket.id}}",
    "updated_at": "{{ticket.updated_at_with_timestamp}}",
    "text": "{{ticket.requester.organization.name}}"
    }

    0
  • Jeremy Heath
    コメントアクション Permalink

    Nvm it doesnt work just adding it to the slack trigger

     

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

    Hi Jeremy,

    Are you using the official Zendesk-Slack integration or a HTTP target?

    I would recommend the latter if you don't need the ability to create new tickets or update tickets from Slack.
    Also, I'm not able to save any changes to the official integration trigger, so I don't see how you even could modify that.

    The HTTP target article specifies how you can set up a message push from Zendesk to Slack, it skips over the creation of a Slack webhook though. Let me know if you'd like more details about doing that.

    If you are somehow able to update the Slack trigger action json, I think this would be what you're after:

    {
    "text": "*New ticket* : <https://YOUR-ACCOUNT.zendesk.com/agent/tickets/{{ticket.id}}|{{ticket.title}}>.\n*Requester* {{ticket.requester.name}} \n*Organization*: {{ticket.requester.organization.name}} \n*Updated*:{{ticket.updated_at_with_timestamp}}."
    }

    Be sure to change the YOUR-ACCOUNT bit to your Zendesk subdomain.

    For me it looks like this:

    0
  • Jeremy Heath
    コメントアクション Permalink

    I am just using the Zendesk-Slack integration

    I dont need to make tickets from Slack at all its just purely a warning when a new or updated ticket arrives

    To modify the official trigger you have to Clone it then disable the original one then you can edit the json

    I tested that piece of code in the official json and it doesn't create the slack popup :( but thanks for the assist.

    I may have to go webhook option to get the text i need, I think we might already have a webhook for our server stuff ..

     

    Is it possible to get different messages for different events? getting ahead of myself but curious.

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

    Ah, yes remember doing the cloned trigger workaround also, but it stopped working for some reason.

    You can definitely have multiple triggers for different events.

    I'm going to detail out the steps in a separate post and come back and like to it here in a moment.

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

    Hi again Jeremy,

    I did a write up here for setting up your use-case.

    Hope you find it helpful.

    0
  • Jeremy Heath
    コメントアクション Permalink

    Ok i went after the Http method which you suggested

    and ive managed to get it through

    But..

    It gives the same display all the time.If its a new ticket like the example above, on an update ticket it doesnt add the webhook bit

     

    Is there a way to get it to show New Ticket and Update Ticket depending on whats come in?

    0
  • Jeremy Heath
    コメントアクション Permalink

    Im using this atm

    {
    "text": "*Ticket Name* : <https://desk.com/agent/tickets/{{ticket.id}}|{{ticket.title}}>.\n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}}."
    }

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

    Is there a way to get it to show New Ticket and Update Ticket depending on whats come in?

    Yes. I think the simplest way to do that is to have two triggers that don't overlap - one with criteria for updates, the other for created tickets. The JSON would then be modified to reflect whether it is a ticket creation or a ticket update.

    0
  • Jeremy Heath
    コメントアクション Permalink

    So i need to split them then atm they are both in same trigger..ok

     

    Is there away to change the text incoming webhook? to Zendesk New Ticket

    just an example

     

    How do i modify to know which is update or creation?

     

    0
  • Jeremy Heath
    コメントアクション Permalink

    Got them separated but it still misses the webhook? on the second one

    Odd thing i noticed it also responds to a trigger that checks for tickets over an hour, it doesnt change the ticket but it trigger the webhook when it sends me an email to warn me

    0
  • Jacob J Christensen - Cloudhuset A/S
    コメントアクション Permalink

    Great! I think the "incoming-webhook" (author) text will only show up when beginning a message thread or if others have commented in between messages - that's just Slack being Slack.

    It sounds like you have an automation updating certain tickets, and that's triggering your Update trigger. 

    If that is the case you can add a condition to ignore updates made by an Automation for your Update trigger, like so:

    Hope that helps you out.

    0
  • Jeremy Heath
    コメントアクション Permalink

    This is usefull thx

    Its all good we have some pretty banging prompts now that tell us what we want

     

    Many thanks

    1
  • Andres Rincon
    コメントアクション Permalink

    Jacob J Christensen - Cloudhuset A/S

    Hey Jacob,

     

    Is it possible to change the color value in JSON to represent the ticket status? Yellow = new, red = open, etc.

    0
  • Jacob J Christensen - Cloudhuset A/S
    コメントアクション Permalink

    Hi Andres Rincon

    Yes, that should be doable.

    I did a quick test of one way to do that, see example below.

     

    If you followed the guide I wrote here about pushing a message to Slack here, you could update the JSON body to the below instead:

    {% case ticket.status %}
    
    {% when 'New' %}
    
    {
        "text": "A ticket has been updated to *{{ticket.status}}* \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
        "attachments": [
            {
    			"color": "#FFB648",
                "fallback": "See review here: {{ticket.url}}",
                "actions": [
                    {
                        "type": "button",
                        "text": "Go to ticket in Zendesk",
                        "url": "http://example.zendesk.com/agent/tickets/{{ticket.id}}",
                        "style": "primary"
                    }
                ]
            }
        ]
    }
    
    {% when 'Open' %}
    
    {
        "text": "A ticket has been updated to *{{ticket.status}}* \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
        "attachments": [
            {
    			"color": "#E34F32",
                "fallback": "See review here: {{ticket.url}}",
                "actions": [
                    {
                        "type": "button",
                        "text": "Go to ticket in Zendesk",
                        "url": "http://example.zendesk.com/agent/tickets/{{ticket.id}}",
                        "style": "primary"
                    }
                ]
            }
        ]
    }
    
    {% when 'Pending' %}
    
    {
        "text": "A ticket has been updated to *{{ticket.status}}* \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
        "attachments": [
            {
    	        "color": "#3091EC",
                "fallback": "See review here: {{ticket.url}}",
                "actions": [
                    {
                        "type": "button",
                        "text": "Go to ticket in Zendesk",
                        "url": "http://example.zendesk.com/agent/tickets/{{ticket.id}}",
                        "style": "primary"
                    }
                ]
            }
        ]
    }
    
    {% when 'Solved' %}
    
    {
        "text": "A ticket has been updated to *{{ticket.status}}* \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
        "attachments": [
            {
    	        "color": "#87929D",
                "fallback": "See review here: {{ticket.url}}",
                "actions": [
                    {
                        "type": "button",
                        "text": "Go to ticket in Zendesk",
                        "url": "http://example.zendesk.com/agent/tickets/{{ticket.id}}",
                        "style": "primary"
                    }
                ]
            }
        ]
    }
    
    {% when 'Closed' %}
    
    {
        "text": "A ticket has been updated to *{{ticket.status}}* \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
        "attachments": [
            {
    	    	"color": "#D8DCDE",
                "fallback": "See review here: {{ticket.url}}",
                "actions": [
                    {
                        "type": "button",
                        "text": "Go to ticket in Zendesk",
                        "url": "http://example.zendesk.com/agent/tickets/{{ticket.id}}",
                        "style": "primary"
                    }
                ]
            }
        ]
    }
    
    {% else %} 
    
    {
        "text": "A ticket has been updated to *{{ticket.status}}* \n *Requester* {{ticket.requester.name}} \n *Organization*: {{ticket.requester.organization.name}})",
        "attachments": [
            {
    	        "color": "#333333",
                "fallback": "See review here: {{ticket.url}}",
                "actions": [
                    {
                        "type": "button",
                        "text": "Go to ticket in Zendesk",
                        "url": "http://example.zendesk.com/agent/tickets/{{ticket.id}}",
                        "style": "primary"
                    }
                ]
            }
        ]
    }
    
    {% endcase %}

    Remember to update the links to your own (if you want that).

    This is one way to do it, there may be easier or smarter ways, but that's my solution, for now, I hope you can use it.
    Feel free to come back and share your own solution if you want.

    Edit: I removed an unnecessarry reference to channel from the code example.

     

    0
  • Andres Rincon
    コメントアクション Permalink

    Jacob J Christensen - Cloudhuset A/S

     

    Awesome, what a lifesaver. Thank you! 

    0
  • Andres Rincon
    コメントアクション Permalink

    Jacob J Christensen - Cloudhuset A/S

     

    I actually got a parse error on line one, I did some research online but couldn't figure out why. any ideas?

     

    edit: noticed it still works regardless of the error. Is it anything to be concerned about?

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

    Hi Andres,
    I think that is just the input expecting pure JSON and when it sees the liquid markup it throws this error.
    Like you said it still saves and works, and I don't think there is anything to worry about.
    Glad you got it working 😉

    0

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

Powered by Zendesk