Tag: whd
Building a Better WHD Notifier
by TrueJournals on Jun.29, 2012, under programming, technology
At my work, we use Web Help Desk to track support tickets. It’s a very nice, very slick piece of software, and from my understanding, version 10.2 implements an API going forward. Unfortunately, we use version 10.1.10.1, which doesn’t have the same API.
The problem I ran into was this: often, there are other tasks to be completed, so I’m not just staring at the WHD ticket queue the entire time I’m at work. However, if a client logs a ticket, I have no way of being notified without going to the web help desk page and checking manually. This results in one of two things happening: either I check the ticket queue every few minutes, breaking my workflow on other projects, or a ticket doesn’t get responded to for a while.
I wanted a way to be notified of new or updated tickets that pop up without having to continually go back to the WHD tab of my browser to actually check for new or updated tickets. Unfortunately, without an API, I thought this was going to be difficult. Until I found this: a WHD Notifier for Chrome.
However, this still didn’t quite achieve what I was looking for. While this did provide me with a notification of the number of new or updated tickets within the browser, it didn’t notify me when this number changed. So, I still had to watch my web browser, and even then, continually check this small, inconspicuous number in the top-right corner of my screen. Since Chrome extensions are simply Javascript, HTML and CSS, I decided to try my hand at modifying it to better suit my needs.
Here’s the list of things I needed:
- Pop-up notifications of a change in the number of new/updated tickets (like in Gmail).
- The ability to not save username and password. The computers share a single profile between multiple users, so I don’t want individual passwords saved past the browser session.
- (Optional, if I could figure it out) Grabbing login info from the WHD web login, so you don’t have to go into the extension options every browser session.
After some coding, a lot of trial and error, and a lot of research, I was able to meet all three goals. If you’d find it useful, you can download WHD Notifier version 1.5. Simply configure it with your WHD URL, choose what to display/be notified of, and you’re good to go. If you login to web help desk, the notifier will grab that login information and start updating.
If you’re interested in seeing the source code for this extension, you can find a zip of the source here. I’ll see if I can throw it up on GitHub later today or this weekend. There’s some interesting things being done here — submitting the login form in WHD sends a call to forms.submit() instead of going through the normal submit procedure — this means that I couldn’t simply add an onsubmit handler to capture the login information.
Instead, I inject another piece of JavaScript into the page which overrides the submit() method for all forms. This calls chrome.extension.sendMessage to message the background page with the username and password, then proceeds to call the submit() method I had overridden. You can find the form handling things in autoLogin.js and autoLogin2.js. I had to inject autoLogin2.js on the page because chrome content scripts aren’t allowed to override prototype methods.
If we ever update our WHD installation, I’ll try to update this extension again to use the new API — I should be able to add some more features with that, too. For now, this should work for all versions of WHD 10.0.8 or later.
Update: Code is now on GitHub