Zendesk Script – List all suspended Users.

No Comments

It’s been long since I last updated the blog. I’ve been “busy” with christmas parties and traveling between Dublin and Cork (and Spain!). Yay, I’m now home for the holidays. :)

Today I bring you a small script that can be pasted in the Developer Tools console once you are logged into your Zendesk account and will list all the suspended users for your account with a link to see their profiles.

var v_subdomain = "SUBDOMAIN";
var v_users_amount = USERCOUNT;

function getUsers(page) {

    $.ajax({
        url: "https://"+v_subdomain+".zendesk.com/api/v2/users.json?role=end-user&page=" + page,
        type: "GET",
        dataType: "JSON"
    }).done(function(results) {

        var userList = results.users;
        for (var i = 1; i < results.users.length; i++) {
            if(userList[i].suspended){
                console.log('User: '+userList[i].name + ' - https://'+v_subdomain+'.zendesk.com/agent/users/'+userList[i].id+'/requested_tickets'  );
            }
        }
    });
}

for (var j = 0; j < Math.ceil(v_users_amount/100); j++) {
    getUsers(j + 1);
}

It’s really easy to use.

  1. Edit the values for v_subdomain and v_users_amount.
  2. Log in into your Zendesk account. (I always use Google Chrome)
  3. Open the Developer Tools.
  4. Paste the code and press enter.
  5. Enjoy!

As always, you can find this script with the other ones in my GitHub Profile.

I almost forget! The progress on the Taskmanager ruby app has been amazing and I hope I will have a post coming out soon! ^_^

Happy coding and enjoy the holidays!!