Round robin ticket assignment
By Michael Stone of BetterCloud and Bill French of iPad CTO
Overview
We worked with Bill French of iPad CTO to develop this Zendesk Round Robin Ticket Assignment application. This application was made using Google Apps Script and is built entirely in Google Docs. You can run this script as long as you have an active Gmail or Google Apps account.
This script is run off of a simple spreadsheet (linked below) which is used to manage your support team and the tickets that will be assigned to them. Assignments are made based on tags. We recommend you use Triggers to have a tag automatically applied to each ticket as it is submitted.
CLICK HERE TO CREATE A ZENDESK ROUND ROBIN APP
Steps
After you download the Round Robin app, follow these steps.
Create a trigger
Create a Trigger based on your criteria to add a Tag when the ticket is created.
This app will assign your tickets out based on this tag. It is very important that this Tag matches the tag placed in the Notes field of your column headers.
Set up the apps script
On the spreadsheet, navigate to: Tools > Script Editor.
- Set the [Spreadsheet ID] value in Line 10 to the ID of your spreadsheet.
This can be found in the URL of your spreadsheet after ‘http://…...spreadsheet/ccc?key=’ and before the ‘&’
CommunityTip - Google spreadsheets have a new URL format. There isn't any ampersand (&) symbol in the Google Docs / now Google Drive URL. Instead, just grab the info after https://docs.google.com/spreadsheet/ccc?key= and before #gid=0 (see attached screenshot - I obscured my spreadsheet ID).
- Set the [subdomain] value in Line 23 to your Zendesk subdomain.
For example if your Zendesk domain is: subdomain.zendesk.com, the value here would be: subdomain.
- Set the [username] value in Line 24 to your Zendesk username.
For example: mike@bettercloud.com
- Set the [Zendesk API KEY] value in Line 25 to your current Zendesk API Key.
This can be found by clicking the Manage icon then selecting Channels > API.
Community Tip - Save the API setting! If you don't already have Token Access enabled in Manage > Channels > API, you need to check that box AND CLICK THE SAVE BUTTON. I checked the box, copied the API token and went on my merry way only to find out that nothing was happening... until I went back and double-checked everything and figured out that I hadn't clicked the save button on that settings page. Also note that Zendesk issues a new API token if and when you enable it for the second time.
Set up automatic updates
To automate the process of assigning tickets in a timely fashion, you must use a trigger in Google Docs to run the makeAssignment() function every five minutes or perhaps at intervals suitable to the flow of the tickets being received.
- Select the Tools | Script Editor... from the sheet, and then select Resources | Current project’s triggers
- Run: makeAssignments Events: Time-driven: minutes timer > Every minute
Sample use case
We currently have four different Forms that End-Users can submit tickets under: Question, Problem, Account Inquiry and Other. We have set-up a Trigger that applies the tags ‘form_question’, ‘form_problem’, ‘form_account’, and ‘form_other’ when a ticket is submitted. Any users with an ‘x’ next to their name will be assigned the next ticket that comes in with that tag (as long as they are next in the queue).
You can use this script with other tags as well, it does not need to be used with Forms in particular. However, these tags must be applied to the ticket once it is created in order for the script to run properly.
Community Revisions
11/29/17
Rob Baker was kind enough to share his version of the Zendesk Round Robin Script titled 'Zendesk Roulette'. Here is a list of the new features and a link to the updated script:
* Added Properties so that each function could be called independently | |
* Added a main function so script can be manually run | |
* Added search filter changes to limit results to only tags of interest and oldest tickets first | |
to avoid hitting script processing time limits | |
* Limited assignment to a maximum of 10 tickets per pass to avoid the entire queue from being assigned at once | |
* Fixed an issue where the last agent assigned would continue to be pushed tickets if there were no active agents | |
including the previously assigned agent | |
Variables that need to be populated prior to use | |
* [YourSheetID] | |
* [YourSubDomain] | |
* [YourUserName] | |
* [YourToken] | |
* [YourTags] https://github.com/grnhse/zdr/blob/master/zendeskMakeAssignments.gs |
-
@Ravi -- sorry to hear that! If you decide to give it another try feel free to reach out.
-
Hi ZD Community -
This may be common knowledge for the more technical, but be sure to EXCLUDE the [ ] when you enter your information in to rows 10, 23-25 in the script editor.
Hope this saves you some time troubleshooting
-
Ryan, thanks for sharing the troubleshooting tip!
-
Hi all,
We have also been using this application for a few months, and it was a life changer.
I am however encountering an issue.
I know that this application's template was created on the old version of Google Sheets, which works fine for me.
The issue is, if I create an application from scratch using the newest version of Google Sheet, the application does not run.
I receive the error message
"Line 63 - Your spreadsheet has reached the maximum of 5000 characters per cell".
Line 63 in the script is the following: logSheet.insertRowBefore(2)
I cannot figure out what causes this error.
Has anyone run into a similar issue?
Thanks
-
I am also receiving the error below when trying to run the MakeAssignments trigger
Request failed for https://raceitsupport.zendesk.com/api/v2/search.json?query=type:ticket%20status:new%20assignee:none returned code 422. Truncated server response: {"error":"invalid","description":"Invalid search"} (use muteHttpExceptions option to examine full response) (line 160, file "zendeskMakeAssignments")
I didn't make any changes to the code so I'm not entirely sure what's going on... @Gareth or @Michael what was the solution for this?
-
Here i am receiving the error
returned code 401. Truncated server response: {"error":"Couldn't authenticate you"
-
Hi all,
I'm doing some research on the problems Zendesk customers are trying to solve with this (or other) round robin processes. If you're interested in chatting with me about round robin or the general problem of agents cherry-picking tickets, drop me a line at eboyle@support.zendesk.com.
Thanks in advance!
Erin
-
Hi folks!
I'm trying to get this going, but I'm having trouble.
Looking at the Execution Transcript I can see that it's isolating out the right tickets, (the ones unowned ones with the tag).
But the script is consistently throwing this error:
Your input contains more than the maximum of 50000 characters in a single cell. (line 63, file "zendeskMakeAssignments")
Any insight is appreciated!
-
Hey @Amanda,
Sorry for the delay in response! Please try commenting out (or completely deleting) line 32:
"debugSheet.getRange("A2").setValue(searchTickets);"
To comment it out, simply add "//" to the beginning of the line. It will look like this:
" // debugSheet.getRange("A2").setValue(searchTickets);"
Once you have done this, re-run the script and let me know the results.
Thanks!
Mike
-
@Michael, Thank so much! That did in-fact allow the script to the ticket assignment; I think we're good! :D
-
Awesome @Amanda! Happy to help.
-
Hoping someone could assist I am getting the below error and our calls are not being assigned to anyone
Bad request: https://fctsa.zendesk.com/api/v2/tickets/102497.json (line 193, file "zendeskMakeAssignments")
-
Hey Nadia,
Google is experiencing some serious issues today which are almost definitely causing these failures:
https://status.cloud.google.com/incident/appengine/15025
Hope this helps. Sorry for any inconvenience.
-
Google apps is back up but the problem still persists.
Seems like the zendesk API might be acting up. I get the following header when trying to assign via curl:
X-Zendesk-API-Warn: Removed restricted keys ["{\"ticket\":{\"assignee_id\":0000000000}}"] from parameters according to whitelist
*note, I changed the actual assignee_id to all zeros.
The call I made was:
curl https://ttgithelp.zendesk.com/api/v2/tickets/00000.json -H "Content-type=application/json" -d '{"ticket":{"assignee_id":0000000000}}' -v -u email@removed.com/token:tokenremovedforsecuritypurposes -X PUT
I am getting the same "removed restricted keys" warning header with any PUT /api/v2/tickets/{id}.json call.
-
Thanks @Eric, I'm still experiencing issues as well. Wrote into Apps Script help forum and community. Hoping to hear back soon. I'm experiencing this issue with a number of scripts and APIs. Not entirely sure it's specific to Zendesk API, but definitely possible.
-
Hey all,
Figured it out -- you will need to:
1) Head into your script (Tools > Script Editor)
2) Replace lines 182-190 with the following:
https://gist.github.com/anonymous/179b6b18b28afc2351d3
I've updated the template file attached to this post as well.
Let me know if you have any questions on this.
Mike
-
Hi Mike
You are a legend just made the changes on my end and round robin is working again.
Thank you for your help!!
-
Awesome!! Happy to help
-
Michael, you've done it again. Thank you tremendously. It's truly appreciated.
@communitymoderator - Not to underscore the work Michael has done for me and others in the Zendesk community, but can you please explain why we can't have this added as an application or out of the box functionality for Zendesk?
Thank you!
-
Michael, thank you for your help! The script works now. Could you please shed some light, what was the reason? Was something changed in ZenDesk API?
-
Hey Alina,
Apologies for the delay. The script broke due to a change Google made on the Google Apps Script service. More specifically, they changed the way you configure the headers of an OAuth request.
For more info, take a look here: https://plus.google.com/u/0/+MichaelStone4/posts/2Qe7UbFnRZC
Hope this helps.
Mike
-
Hi all,
We've just opened up a new beta for a feature we're calling Play-only Agents. This is not a round-robin assignment feature, but rather a way to indicate certain agents should only be able "Play" through views. The intention behind the feature is to help prevent cherry-picking of tickets, but also ensure certain agents are working on tickets in the correct order.
If you're interested in learning more and participating in the beta, please sign up here: goto.zendesk.com/playagentsbeta
Best,
Erin -
Hello fellow Zendesk and Round-Robin enthusiasts!
Strangely I cannot add additional columns to my existing Round Robin app to assign based on a new tag. Despite leaving the default of checking the first 12 columns.
And after hving so much trouble with the functioning app I created got the template fresh from the link in this thread's originating post and when I get that new one going (and I've done it three times now) it seems to get stuck after looking at 100 tickets (per the Assignment log). I've been studying the script in the script editor. Besides what I've already tried, I'm not sure where to start - I'm really stuck!
-
Hi team,
We're still having trouble with our Round-Robin. I have the job running every 5 minutes and I notice only 1 or two tickets get added to the assignment log for each time it runs.
When I take a fresh stab at setting up the app/script I manually run MakeAssignments, but when I do so it only ever looks at 100 tickets (per assignment log). Perhaps the problem I am facing is that the app is not looking at older tickets that still need to be assigned. I cannot run the getOpenTickets or seekOpenTickets manually, both give me errors about authentication (hardcoding our Zendesk subdomain in line 137 just through a diff error that I am not equip to address), although clearly some tickets are getting found for the MakeAssignments part to have successfully run through 100 tickets when I manually ran it.
Lastly, I'll mention that: all the assignment log entries after the first 100 have nothing in the "Action Taken "column whereas the first 100 have "Not Valid form type". - in case this is telling of something.
If anyone has some ideas in regards to this, please let me know - we're really eager to have this working for our team! Thanks so much!
-
Hey Amanda,
I apologize for the delay in response -- can you please email me directly (mike@bettercloud.com)? I'm happy to look into this with you.
Mike
-
This works beautifully for us. I just started a trial Zendesk account today and this was one of the first features I investigated. I was a bit confused that the Queue column in the spreadsheet is not for me to update and the other headings have to be lowercase (it seems), but this works quite nicely, thank you! :)
-
Hi we just set this up and it's pulling tickets properly in the log, however it's saying under Action Taken column: "Not Valid Form Type" and then never assigns the ticket.
Any ideas? Thanks!
-
Hey Aj,
Can you please confirm you do not have any extra spaces in the headers where you put your form tags? Feel free to shoot me an email at: mike@bettercloud.com . I'm happy to help you troubleshoot further.
-
Just wanted to say thanks for making this, fantastic work!
I modified it a little so it works off week days instead of tags and now its a roster driven ticket assignment system.
-
Hello Michael,
I want to let you know that I've been using your round robin sheet/script combo and am in love with it as a free alternative!
My only point of contention is that the queue column consistently wipes out all but one 'x' leaving a single agent active. There doesn't seem to be any rhyme or reason to it either, it will sometimes stay populated for hours and, at other times, only minutes. I feel like this must be operator error since I haven't seen it reported by any other Users.
Do you have any idea what might be happening?
Por favor, entrar para comentar.
111 Comentários