Adding Chat to Zendesk: Real-time web technology with Firebase

Together with our upcoming HTML5 release, we will be introducing more and more real-time features into QuickSchools. The web is getting social, and we need these real-time features in order to make social features work.

This is where a service called Firebase comes in. They offer a fantastic service that allows developers like us to have access to a secure & scalable real-time backend. But before we roll it out in our main QuickSchools product, we tried it out in our internal Zendesk customer service portal. Like many customer-service oriented companies, we use Zendesk internally to manage customer tickets.

We decided to build a chat widget in Zendesk that would allow our customer service agents to chat with each other in real-time. This way they wouldn’t need to use a separate instant messenger (IM) product, and can focus more on the customer issues at hand.

So how was our experience building this chat widget? In short, it was excellent. It took only half-an-hour to build the chat widget! <– I threw in an exclamation mark in there because that’s how I felt – pretty amazed. Of course we can improve it as we go on, and Firebase still has authentication features pending, but it was a great start.

Here’s a screen-shot of our simple chat widget embedded in Zendesk:

Here’s the HTML code for the chat widget. Feel free to use it if you wish. But of course you’ll need to head over to Firebase and get a beta invite to get going.

{{}}, we now have chat.
<textarea id="taWidget" style="height:100px;"></textarea>
<input class="inputWidget" type="text" />
<input class="updateButton" type="button" value="Send" />
loadJs = function(jsFile, successFunction) {
 url: jsFile,
 success: successFunction,
 dataType: "script",
 cache: true // Cache whenever possible
var fb;
loadJs("", function() {
 console.log("Loaded firebase!");
 fb = new Firebase('');
 fb.remove(); // Clear the old messages.
fb.on("child_added", function(snapshot) {
 var newChild = snapshot.val();
var ta = jQuery("#taWidget");
ta.text(ta.text() + newChild.user + ": " + newChild.msg + "\n");
jQuery(".updateButton").click(function() {
 var inputText = jQuery(".inputWidget");
 fb.push({"user": "{{}}", "msg": inputText.val()});

One thought on “Adding Chat to Zendesk: Real-time web technology with Firebase

Leave a Reply