Workflow: How to receive notifications in Slack when a ticket is rated negatively

<p>To handle concerns proactively and improve customer satisfaction (CSAT), set up a workflow that sends notifications in Slack when a ticket receives a negative rating. Achieve this goal through a combination of a custom Slack app with an incoming webhook, a Zendesk webhook, and a trigger.</p><div class="note important">
<span class="importanttitle">Important:</span> In compliance with Privacy and Data Protection Laws, admins need to configure a way to redact or sanitize personal data before allowing routing of ticket details to third-party webhooks. </div><p>The workflow includes these steps:</p><div style="margin-bottom: 20px; text-align: right;">
<button id="master-toggle" class="btn fw-semibold text-dark" data-action="expand" style="background-color: #DEF991; border: none; outline: none; border-radius: 7px; padding: 10px 20px; font-size: 15px; transition: background-color 0.2s ease;" onmouseover="this.style.backgroundColor='#cbef6d'" onmouseout="this.style.backgroundColor='#DEF991'">
Expand all tabs
</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const toggleBtn = document.getElementById('master-toggle');

toggleBtn.addEventListener('click', function () {
const action = this.getAttribute('data-action');
const headers = document.querySelectorAll('.accordion');

headers.forEach(header => {
const isActive = header.classList.contains('active');
const panel = header.nextElementSibling; // Grabs the corresponding .panel container

if (action === 'expand' && !isActive) {
// Open it by simulating a standard click
header.click();
} else if (action === 'collapse' && isActive) {
// Close it by simulating a standard click
header.click();
}
});

// Flip button text and states
if (action === 'expand') {
this.setAttribute('data-action', 'collapse');
this.textContent = 'Collapse all tabs';
} else {
this.setAttribute('data-action', 'expand');
this.textContent = 'Expand all tabs';
}
});
});
</script><div class="accordion"><h3 id="h_01J3K9CS2BSA3GTCRCTJDW5DMX">Step 1: Create an app in Slack and an incoming webhook</h3></div><div class="panel">
<ol>
<li data-list-item-id="e9e0bf4d130467fe2f0245ce4a32b59b0">Create a custom Slack app from the Slack API document: <a href="https://api.slack.com/apps/new" target="_blank" rel="noopener noreferrer">Your Apps</a>.<br>This example names the Slack app <strong>CSAT Notifier</strong>.</li>
<li data-list-item-id="ebac61844e8dd399e0be76510e0001c43">In Slack, turn on <strong>Incoming Webhooks</strong> with the toggle under <strong>Features &gt; Incoming Webhooks</strong><br><img src="/attachments/token/PHWX9C0uIrgIItdMvqHh0Stm7/?name=image.png" alt="">
</li>
<li data-list-item-id="e73959d1f0e4a62fbf2c80d6857474dca">At the bottom of the <strong>Incoming Webhooks</strong> page, select <strong>Add a New Webhook to Workspace</strong>. During configuration, choose the channel to receive notifications from the dropdown menu. This example creates a unique Slack channel, <strong>#zendesk-bad-csat</strong>, to receive notifications.<br><img src="/attachments/token/9lIZ7SboHqZK8GlxkJpYbarcU/?name=Screen+Shot+2022-07-13+at+3.06.55+PM.png" alt="" width="455" height="321">
</li>
<li data-list-item-id="e71bfa6ad5cc7a3b6c05e9061e4f3707b">After you create the URL, the system returns you to the URL list for your app. Copy the new URL with the <strong>Copy</strong> button.<br><img src="/attachments/token/70kohZBtV8KXMa6p0qHXqVUx0/?name=Screen+Shot+2022-07-13+at+3.19.03+PM.png" alt="">
</li>
</ol>
<p>For more information to create Slack webhooks, see <a href="https://api.slack.com/messaging/webhooks" target="_blank" rel="noopener noreferrer">Sending messages using Incoming Webhooks</a>.</p>
</div><div class="accordion"><h3 id="h_01J3K9D0M7PMV5GNACNP37M7YP">Step 2: Create a webhook in Zendesk to send CSAT tickets to your new Slack webhook</h3></div><div class="panel">
<ol>
<li data-list-item-id="eec79e185951c340f1af82939f07ceb54">In Zendesk, <a href="https://support.zendesk.com/hc/en-us/articles/4408839108378-Creating-webhooks-in-Admin-Center" target="_blank" rel="noopener noreferrer">create a new webhook</a>
</li>
<li data-list-item-id="ea1bf1bd14691d583c394a636aef6e7b3">
<p>Use the following configuration: <br><strong>Name |</strong> Send negative CSATs to Slack <br><strong>Endpoint URL |</strong> [Paste the Slack incoming webhook URL copied from step 1.4] <br><strong>Request method | POST</strong> <br><strong>Request format | JSON</strong> <br><strong>Authentication | None</strong></p>
<div class="p"><div class="note">
<span class="notetitle">Note:</span> No credentials are required. The URL itself includes the secret required to POST messages.</div></div>
</li>
</ol>
<p dir="auto">The webhook looks similar to the image below.</p>
<div class="zd-indent"><p dir="auto"><img src="/attachments/token/EQETKG03NnsADnh7AA2F4YStE/?name=Screen_Shot_2022-07-13_at_3_31_16_PM.png" alt="" width="484" height="525"></p></div>
</div><div class="accordion"><h3 id="h_01J3K9D546631F1G3A7RHXRWGD">Step 3: Create a trigger to send negative CSAT tickets to your Slack channel</h3></div><div class="panel">
<p>Lastly, create a trigger to specify which tickets to send to your channel. In this example, the trigger notifies any tickets that receive a <strong>Bad</strong> or <strong>Bad with comment CSAT</strong>. Follow the steps below to create this workflow.</p>
<p>To create the trigger:</p>
<ol>
<li data-list-item-id="e6bba367f3b2446585dacbf871cc979ee">Create a <a href="https://support.zendesk.com/hc/en-us/articles/4408886797466-Creating-ticket-triggers-for-automatic-ticket-updates-and-notifications" target="_blank" rel="noopener noreferrer">new trigger</a>
</li>
<li data-list-item-id="ee62fa80d8c1c8c9d0c5e96fe6093cf42">Under <strong>Meet ALL of the following conditions</strong>, add: <br><strong>Object</strong> &gt; <strong>Ticket &gt; Ticket</strong> | <strong>Is</strong> | <strong>Updated</strong>
</li>
<li data-list-item-id="e2f91db234960ba0199d37978ed84447e">Under <strong>Meets ANY of the following conditions</strong>, add: <br><strong>Object</strong> &gt; <strong>Ticket &gt; Satisfaction</strong> | <strong>Changed to</strong> | <strong>Bad</strong> <br><strong>Object</strong> &gt; <strong>Ticket &gt; Satisfaction</strong> | <strong>Changed to</strong> | <strong>Bad with comment</strong>
</li>
<li data-list-item-id="ebaf2f34aa9d5bb75deb5fa834412a929">
<p>Under <strong>Actions</strong>, add: <br><strong>Other</strong> &gt; <strong>Notify by &gt; Active webhook</strong> | Select the webhook you created <br>In the <strong>Body</strong>, enter the Slack notification in JSON format. For example:</p>
<pre class="wysiwyg-code-block"><code class="language-auto">{"text":"You've received a negative CSAT. See information below \n ticket ID:{{ticket.id}} \n ticket link: {{ticket.link}} \n csat rating: {{satisfaction.current_rating}} \n csat comment: {{satisfaction.current_comment}}"}</code></pre>
</li>
<li data-list-item-id="ec318a67388be9d20c6580f9ea474c845">Click <strong>Create trigger</strong> <br><strong><img src="https://support.zendesk.com/hc/article_attachments/8575899472154" alt="Trigger to post in Slack when a ticket gets a negative rating.png" width="1970" height="1989"></strong>
</li>
</ol>
<p>In the example above, the JSON body sends the ticket ID, a link to the ticket, the CSAT rating, and the CSAT comment to the Slack channel.</p>
<p>JSON is highly customizable. Configure <a href="https://api.slack.com/messaging/webhooks#advanced_message_formatting." target="_blank" rel="noopener noreferrer">formatting options</a> for Slack webhooks and include ticket-specific information with <a href="https://support.zendesk.com/hc/en-us/articles/4408886858138-Zendesk-Support-placeholders-reference" target="_blank" rel="noopener noreferrer">Zendesk placeholders</a>. To customize the Slack message, start the JSON body with <code>{"text":}</code> so Slack receives the correct format.</p>
<p>After you create the webhook and trigger, you receive the formatted Slack notification when your account receives a bad CSAT rating.<br><img src="/attachments/token/oeQDBNFfesNUoaRJ2IvxvyCGA/?name=screen_shot_2022-07-13_at_4_18_59_pm.png" alt="" width="548" height="191"></p>
<div class="p"><div class="note tip">
<span class="tiptitle">Tip:</span> To configure other notifications in Slack, see <a href="https://support.zendesk.com/hc/en-us/community/posts/4409515187866-Push-notifications-from-Zendesk-to-Slack" target="_blank" rel="noopener noreferrer">Push notifications from Zendesk to Slack</a>.</div></div>
</div><p> </p><p> </p>