Skip to main content

Mashing up Freshdesk with KooKoo for customer support ticket management

Sorry for the delay in writing a blog post. I have been caught up in too many things since last month(we are growing, so its all good :))

Anyway, this week I thought I will look at how we can use the latest rockstar startup from India, Freshdesk. Freshdesk, as most of you know is one of the best "Social Helpdesk" systems out there. I am sure most of you are already using Freshdesk to support your customers.

In this blogpost I will explain how you can add telephony to the mixture. In particular I will show some code which you can use to :

  1. Welcome the caller by name
  2. Ask him to enter his ticket id
  3. Play out the ticket status
  4. Connect the caller to the correct agent handling the ticket.
Luckily for us, Freshdesk has a very well defined API and it was a pleasure to work with it. The engineers were also very supportive and answered all my queries quickly.

So lets get into the code directly.

1. First we need to get the caller information. For this we need to access the contacts.xml endpoint of your Freshdesk with your credentials. So, if your Freshdesk system is at http://yourcompany.freshdesk.com, then your contacts will be at http://yourcompany.freshdesk.com/contacts.xml. 

This will return all your contacts and you can loop through the contacts, fetch their phone number and compare it with the caller id that KooKoo sends you. If a contact matches, return his/her id else return -1.

<code>
function get_user($phone_no)
{
$phone_no = substr($phone_no, -10);
$return = get_curl('http://yourcompany.freshdesk.com/contacts.xml');
$users = new SimpleXMLElement($return);
        //looping through users
       foreach($users->user as $user){
        //compare last 10 digits of the phone number
if($substr(user->mobile,-10) == $phone_no)
return $user->id;
        }
        return -1;
}
</code>

Using the user details and the <playtext> tag of KooKoo you can play out a customized welcome message to the caller.

2. Then use <collectdtmf> and ask the user to enter his ticket id.

3. Once you receive the ticket id from KooKoo, use the tickets.xml endpoint of Freshdesk API to get the ticket details in XML.
Below code, gets ticket and associated agent. The associated agent is returned in the responder-id details.
<code>
function get_agent_phone($ticket_id)
{
        $return = get_curl('http://kookoo.freshdesk.com/helpdesk/tickets/'.$ticket_id.'.xml');
        $ticket = new SimpleXMLElement($return);
        $responder=$ticket->{'responder-id'};
        $return=get_curl('http://kookoo.freshdesk.com/contacts/'.$responder.'.xml');
        $agent=new SimpleXMLElement($return);
        $agent_no=$agent->{'phone'};
        if($agent_no)
    return $agent_no;
       else
    return '-1';
}
</code>

4. Use the ticket details and either use <playtext> to play the details and disconnect the caller or connect the caller to the agent managing the ticket.

The complete code can be downloaded. To use it:
  1. Sign up for a KooKoo account.
  2. Sign up for a Freshdesk account
  3. Update the code to include your credentials.
  4. Host the code in a public location and assign it as a KooKoo URL in your KooKoo settings.
  5. Publish your KooKoo number and start receiving calls.
As usual, this is just the tip of the iceberg. Once you get started on this, you can do a lot more things like, adding customer calls automatically as tickets, handle high priority customers etc.

Popular posts from this blog

First Post

In this blog, I will be talking about my experiences in trying to build a cloud telephony platform , KooKoo . Along the way I will also be talking about different design choices I made, good programming practices and the IVR domain in general. For technoratti: NNFJW8EW86C3

Integrating Arborjs with Angular to create a live calls dashboard

Arborjs  is a cool graph visualization library. Angular  is one of the best JavaScript frameworks and we have been using Angular in a lot of our front end development. When you handle millions of calls, proper visualization becomes very important. Without proper visualization, you can get lost in the mountains of data. So we spend a lot of time to come up with good visualizations to represent the data. Since we loved the cool way in which Arbor represented graph data, we could not wait to hook it up with Angular. Because of Angular's two way data binding, when you hook up Angularjs with Arbor.js you can get a dynamically updated visualization of graph data with cool animations. To give back to the community, we have put up the code online at Github . Basically we have created an Angularjs directive for Arborjs. Please feel free to fork the code and add extensions and use it for your own visualizations. The code is self explanatory with comments inline. Best way to get s