Recent searches
No recent searches
How To Create a Slack Notification When a Ticket View Reaches a Specific Threshold
Posted Oct 10, 2020
The Goal
Our Support team is structured so that you’re spending between 40-80% of your time in the Support queue, depending on your seniority level.
We wanted a way to be notified in Slack once our support queue reached a certain threshold so that individuals that weren’t scheduled to be in the queue could jump in and help out.
Prerequisites
For the specific solution I’ve outlined below, you’ll need the following:
- A Slack account
- A Zapier account on the Starter plan or above
- Your Zendesk API Token
Instructions
Step 1
First, you’ll need a ticket view that shows the exact tickets you’d like to monitor. While you can definitely use a ticket view that already exists, you might want to create a new view entirely
For instance, in my specific case, I wanted to create this threshold notification based solely on tickets that would breach their SLA target within the next 6 business hours.
Once you have the ticket view you’d like to use, be sure to take note of the View ID (hint: it’s at the end of the URL in Zendesk) as you’ll need this ID for Step 4.
Step 2
Log into Zapier and click on the 'Make a Zap' button.
Step 3
For the first step of the Zap, select the Schedule by Zapier app and configure these settings as desired.
In my specific use case, I wanted this zap to fire every hour, but to exclude weekends since we don't offer weekend support at this time.
Step 4
Add a second step to this zap and select Code by Zapier > Run Python. For this step, we’ll be using Zendesk’s Get View Count API.
Simply copy the code I provided here and fill out your own Zendesk account information in Lines 4-7. Be sure to test this step to ensure that it's working as expected.
Step 5
Add another zap step. This time, select the Filter by Zapier app.
In the “Choose field…” dropdown, select Run Python > View Count, and then complete the logic as desired based on when you’d like this notification to be fired.
Step 6
For the final zap step, you’ll want to select the Slack app and configure a notification to the exact channel you’d like to be notified.
Step 7
Save & turn on your zap.
That's it!
Now that this solution has been implemented, our team can focus on their extra-queue-rricular work without feeling like they need to keep a constant eye on the support queue.
If you end up implementing this, definitely let me know. Would love to hear how it's been helping your team or if you found any ways to improve upon this solution.
0
10 comments
丸岡
Thank you for the wonderful tips!
I'm stumbling in Step 4.
I copied zdviewcount.py as it is and entered the necessary information on the 4th to 7th lines, but the following error appears.
Is there anything else I need to fill out?
---
The run python could not be sent to Code by Zapier.
Your code had an error!
Traceback (most recent call last):
File "<string>", line 26, in the_function
KeyError:'view_count'
0
Chandra Robrock
@... Of course! I double checked the code that I actually have deployed in Zapier and I can confirm that the code provided from my GitHub is correct.
That being said, I was able to intermittently reproduce this issue in Zapier when I tried testing this out in a new Zap which is very odd.
I appear to be able to get around this error by clicking back into the Run Python > Set Up Action step, clicking on the ‘Refresh fields’ button once more, and then click on 'Continue' to retest it. Mind giving that a shot?
I'm thinking Zapier might be falsely throwing an error after the code is initially copied & pasted into the zap, but appears to work successfully after that. Let me know how it goes!
0
丸岡
Chandra Thanks for let me know!
When I tried the method I was taught again, it was executed successfully!
0
Christopher Wooten
I am getting an error on this as well. The code does not go down to line 25.
Only filled out the fields as told.
Traceback (most recent call last): File "<string>", line 25, in the_function File "/var/task/requests/api.py", line 75, in get return request('get', url, params=params, **kwargs) File "/var/task/requests/api
0
手塚
Hello Chandra,
This post really helps. Cheers!
However, when I try to enable the zap including the python code, it turns ON once, but it turns back OFF when I reload the page.
Testing each step doesn't occur any errors, and python seems to be working OK, but it seems like the python-step is causing the problem since I tested deleting each step one by one.
Should I contact your support team for this, or is there any known solution?
Thanks in adance!
0
Chandra Robrock
Hey 手塚 - To confirm, are you getting any errors when testing the Python step within Zapier?
If you aren't seeing any errors when testing this step, I'd recommend reaching out to Zapier's team directly for further assistance as you may be running into a bug with their software.
Keep me posted if I can be of any further assistance!
1
手塚
Thank you very much for your suggestion Chandra!
I've contacted Zapier team and they told me to use the "Latest" schedule trigger instead, and now the Zap is working as expected!
I'll leave the screenshot for other people in future cases.
0
Chandra Robrock
Very interesting! Thanks so much for the update. I was going to update the original post but it looks like I'm not seeing both versions of the Schedule by Zapier account within my account.
I wonder if they are slowly rolling this new feature out. I'll try to keep an eye on it in case these instructions need update in the near future. Appreciate it!
1
Kelsey Davis
Trying to implement this Zap & got the error:
"Failed to create a run python in Code by Zapier. Your code had an error! Traceback (most recent call last): File "<string>", line 26, in the_function KeyError: 'view_count' "
I tried the proposed workaround mentioned here & keep getting the error. Has the View Count code documentation changed? Not sure how to best troubleshoot here. Reached out to Zapier and they're not able to help review the code.
0
Chandra Robrock
Hi Kelsey Davis - Apologies for the delayed response! I missed your previous post until just now. I can confirm that nothing has changed & the code appears to still be working on my end, even when I attempt to create a brand new zap within my Zapier account. Would you mind double checking the values you entered for the ZENDESK_SUBDOMAIN, ZENDESK_VIEW_ID, ZENDESK_EMAIL & ZENDESK_API_TOKEN keys are all correct?
When I attempted to reproduce this error, I was only able to do so when Zapier was unable to authenticate me based on the values I provided for those keys. For example, a misspelled email for the ZENDESK_EMAIL key, so I suspect you may need to double check the values you provided in Lines 4-7.
0