Push notifications from Zendesk to Slack



image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

投稿日時:2019年5月09日

The official Zendesk-Slack integration is very powerful, offering out-of-the-box two-way communication in a stylish way, but sometimes you just want a simple notification setup.

I hope this guide is helpful in showing the flexibility possible with Zendesk triggers and Slack.

Create a Slack app (in Slack)

[Alternatively, you could just create an incoming WebHook in Slack]

Make sure you're logged into Slack from your browser and proceed to:

https://api.slack.com/apps/new

Give the app a name that is appropriate, I've chosen Zendesk notifier for this example, and also select which Slack Workspace you want the notifications on (if you have multiple).

Push the Create app button.

On the next screen, under Add features and functionality, select Incoming Webhooks.

Switch on the incoming webhook and click the Add new webhook to Workspace link

Next up select the Slack channel you want the app to post messages to and Authorize.

Copy the webhook URL, we need that for the next step in Zendesk.

Create a Webhook (in Zendesk)

[@... - thanks for updating this section!]

Navigate to the Webooks page: Admin Center > Apps and Integrations > Webhooks, and click Actions > Create Webhook.

 

In the Create Webhook screen, enter:

  • Name which represents the webhook/channel
  • The Endpoint URL which is your Slack Webhook URL from earlier
  • Set Request method to POST


Press Create and then press Complete setup on the following screen.

Now we have created a link from Zendesk to Slack, next we need to create the trigger that will push messages through this connection.

Create a Trigger (in Zendesk)

Navigate to the Triggers page: Admin > Triggers and push the Add trigger button.

Set the conditions for when you want Zendesk to push notifications to Slack

You have a lot of options here to precisely specify what kind of updates you want notifications for, a few examples:

  • A new ticket is created
  • A new ticket is created for a particular channel (e.g. reviews from Trustpilot or Play Store)
  • A ticket with elevated priority is updated by the requester
  • A ticket is updated with a satisfaction rating (Steven Yan has a great post outlining this use case)

Below I set the trigger to fire when a ticket with a priority above Normal is created.

You could have multiple use cases in mind, and create a separate trigger for each of them if you would like.

Set the trigger action to push a message to the Slack target

Again you have a lot of options here, what content you want to include in the notification and you also have a number of styling options as well.

Below is the JSON used in the above example - be sure to update the YOUR-DOMAIN part to your specific Zendesk subdomain.

{
    "text": "<!channel> \n {{ticket.assignee.custom_fields.slack_member_id}} \n 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"
        }]
    }]
}

In the example here, I include an @channel mention, followed by a four-paragraph message stating that there is a ticket has been updated to its current status, there is a button linking to the ticket in Zendesk (for easy access), and the requester name and organization name are also included. There is also a timestamp from the ticket update included.

Here is an example of what it looks like in Slack:

You can pull all kinds of user and ticket data into your message, see the Zendesk Support Placeholder Reference for all available options.

The above example is very basic in terms of style, you may want to add some bling to your messages, and for that Slack has its own message builder. You can add links, buttons, fields, images, and colors to your messages.

💡 Check out the comment section below for more use cases.

💡 You can use placeholders to insert ticket or user content into the message.
💡 You can use Liquid markup to modify placeholder output, for example, have a timestamp converted to something more readable, or have a nested field output only the last element.


8

58

58件のコメント

公式

Hi John,

Great question! If you are referring to custom dropdown field values, you may try the below placeholder as stated in the article Using placeholders for custom fields.

Best,

PJ

 

0


Hi 5051191977882 

I'm not sure that exact event is available, but webhooks do have some article-related events that could be investigated as a triggering event: Article events.

 

👆 This event could be used to start a flow (using a Zendesk webhook), but you would need some kind of middleware (Zapier, MS Power Automate or a ZIS flow for example) to take the Webhook response and modify it into a readable message and send that to Slack.

0


Hello Jacob the Moderator!
Is there a way to create a Team Publishing trigger? For exmple, when a help article has been reassigned?

 

0


6792026753946 That's awesome 👍

 

6699945216666 Sorry I missed your question earlier!
Do you want to have comment updates on tickets create messages in Slack?
I don't see any technical reason you couldn't do this with the proper trigger condition and comment placeholders, however, that sounds like a lot of noise to introduce into Slack, and you may introduce PII that may give you a GDPR headache down the line.

Let me know if I completely misunderstood you 😊

0


That was super helpful, our JSON did indeed have no text element which was an oversight on my part. Thanks so much!

1


This is what it looks like for me in the webhook activity log.

0


Hi 6792026753946 

 

I'm no longer as familiar with Slack, but it looks like the JSON payload you're sending is missing the ‘text’ element, what carries your message.

 

When I look at my Zendesk trigger that has the webhook action, I can see that I have the following payload:

{
 "text": 
 "*New ticket* : <https://YOUR-DOMAIN.zendesk.com/agent/tickets/{{ticket.id}}|{{ticket.title}}>.\n
 *Requester*: <https://YOUR-DOMAIN.zendesk.com/agent/users/{{ticket.requester.id}}/requested_tickets|{{ticket.requester.name}}>.\n
 *Organization*: {{ticket.requester.organization.name}}. \n
 *Status*: {{ticket.status}}.\n
 *Group*: {{ticket.group.name}}.\n"
}

With this payload I get the following message in Slack:

Hope that helps you out!

 

0


Hi 1263169425010 ,

Thanks for your article. I've followed the steps exactly but no matter what I change in terms of auth in Zendesk or Slack, my response on "Test Webhook' returns a 400 no_text and the same under activity for the webhook, 400 Bad Request. 

Do you know how I can fix this issue? 

 

 

0


Hi Chris,

I'm glad you like the post, appreciate that!

I'm not familiar with Talk and how transcripts are handled but if it is added as an internal comment, you should be able to have your trigger hook into the right event and then use one of the comment placeholders for your webook and bring it into the Slack notification.

0


This post is awesome, I followed it step by step and have this working perfectly. Does anybody know if there is a placeholder for voicemail transcripts? This would be a neat inclusion in the Slack notification.

0


Hey there 1263169425010 

I was able to set this up in my instance with no issue, thanks for the great documentation!

I was wondering if someone here or you could point me in the right direction for one request, is it possible to set up some kind of automation or edit the webhook where when a ticket is updated it provides the ticket update in the ticket thread? 

 

0


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

お探しのものが見つかりませんか?

新規投稿