Recent searches


No recent searches

Setting Up a Slack Notifier with Zendesk Webhooks



image avatar

Hawk Swearingen

Zendesk Luminary

Posted Feb 22, 2022

With HTTP targets being depreciated within the Zendesk system, I wanted to post an updated article on how to create a notifier in Slack when certain criteria is met on Zendesk tickets

 

Where to Start

  • To begin, you’ll need to visit the Slack API website: https://api.slack.com/apps 

  • Once there, you’ll click the Create New App button in the top right corner

  • From here, you’ll be greeted with a pop up with two options to create your new app. Select From Scratch

  • Congrats! You’ve created an app! Well kinda…

  • Now you’ve come to a screen that shows a bunch of information that you don’t really need to adjust quite yet. What you need to worry about is the big box that says Incoming Webhooks. Go ahead, give 'er a click

  • From the new page, go ahead and toggle on Incoming Webhooks 

  • Now you’ll see a new box pop up below where you can click a button that says Add New Webhook to Workspace. Yup, you guessed it. CLICK IT 

  • It will then prompt you to select what channel you want to add the app to within your Slack workspace. Go ahead and make your selection and move forward

  • You’ll now see a new webhook URL pop up where we just clicked the button shown above. Go ahead and Copy that URL as we now go into Zendesk to set up the webhook

  • Now navigate over to the Zendesk Admin Center and go to Webhooks. You’ll be greeted with a screen that looks like the below, and you can click Actions in the top right corner and then Create Webhook

  • Now you can name the new webhook and paste the URL we copied from the Slack API website into the Endpoint URL section. There are some additional settings to make sure are set up as follows:

    • Request Method: POST

    • Request Format: JSON

    • Authentication: None

  • You can then test the webhook. Easiest way to test it, is to use the following code and clicking Send Test

    {
    "text": "hello world"
    }
  • If everything above has been done correctly, you should get a screen that looks like this

 

  • Final Step is to set up a trigger to fire off the webhook! My biggest recommendation is to also set up a nullifying tag so that the trigger doesn't constantly fire off notifications when tickets are updated. I'd be more than happy to provide examples of JSON code for the triggers if people are interested!

6

6

6 comments

image avatar

Eric Nelson

Zendesk Developer Advocacy

This is great Hawk! Thanks for posting it. 

0


This is dope! Thanks for posting all these steps, I assumed it was a lot more coding intensive to get something like this set up. 

0


This was amazing... THANK YOU!  I really need help with the JSON body now. I keep getting an error.

 

0


image avatar

Hawk Swearingen

Zendesk Luminary

Whitney Whitmoore Here's an example of how we have set one of our notifiers up:

 {   
 "attachments": [
        {
            "fallback": "<View Ticket - {{ticket.link}}>",
            "title": "Ticket #{{ticket.id}}: {{ticket.title}}",
            "title_link": "{{ticket.link}}",
            "color": "good",
            "text": "Organization: {{ticket.organization.name}}\nForm Type: {{ticket.ticket_form}}\nDue Date: {{ticket.ticket_field_360011632491}}"
        }
    ]
}

 

With that, this is what we get (I've redacted confidential information): 

There are MILLIONS of ways that the JSON can be set up. A more simple example would be: 

{
"text": "New Large Project Ticket Submitted {{ticket.url}}"
}

 

That JSON returns something like this: 

 

I'm no JSON coding expert, so my knowledge is very limited to information I have Googled, but there are plenty of resources out there to help build out something similar to this. Hope this helps!

0


Hawk Swearingen have you tried anything to tag/mention agents?
I have a custom user field that contains everybody's slack IDs, so in triggers I use <@{{ticket.assignee.custom_fields.slack_handle}}> but it's mt first time setting up an automation using JSON

0


image avatar

Hawk Swearingen

Zendesk Luminary

I'm not sure that mentions work within JSON payloads to Slack. I vaguely remember trying it a while back and it not working, but that could have changed recently! Please let me know if you get it to work because this would be fantastic!

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post