Helpdesk User Lookup

How much time do you spend daily finding out additional information about users who send you support tickets? Are they customers or not? How long have they been our customers? What products did they purchase? Our team spends about 20% of their time just looking stuff up. I guess, that number is about the same for your company. Today we introduce a feature that should help us change that.

Our new User Lookup feature lets you pull extra user information from any external service. All the information we get is displayed on the user profile page right in the helpdesk tool, so you can see everything you need without ever leaving the app. Fair warning thought, "User Lookup" is no magic – this is an advanced feature that requires some programming work on your side.

How to use User Lookup

Setting it up in Jitbit Helpdesk is very simple – you just need to enter the URL of your service on the "Custom User Lookup" page in "Integrations" in the admin panel. The URL should look something like this: http://localhost/myscript.php?email=#email#. The URL has to contain #email# – it will be replaced with user's email address.

It's up to you to implement the script. We expect a valid JSON response in return – it will be displayed on the user profile page. Helpdesk makes a new GET request to your script every time any user profile page is opened.

You can use User Lookup not only with your own services, but also with third party apps (CRMs, issue-trackers, etc.), if they have JSON API that can be accessible via a simple GET request.

User Lookup security

It is up to you to implement security of your script. Some simple ways to do that:

  1. Requests always come from the Helpdesk server, not from client's browsers. You can hardcode the server IP address in your script and return nothing, if a request comes from a different IP.
  2. Use some kind of secret key. Your URL could look like this: http://localhost/myscript.php?email=#email#&key=secret. Then check the secret key in your script.
  3. Obviously, using HTTPS is recommended.

Implement all three of those methods and your script will be secure enough.

Code sample: lookup a user in MySQL

Here's a very simple PHP script example that will help get you started:

<?php
$email = $_GET["email"];
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

$conn = new mysqli($servername, $username, $password, $dbname);

$stmt = $db->prepare("SELECT Age, Address FROM MyUsers WHERE email=?");
$stmt->bind_param("s", $email);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
    $row = $result->fetch_assoc();

    //returns: { "Age" : "XXXX", "Address" : "YYYY"}
    echo "{ \"Age\" : \"";
    echo $row["Age"];
    echo "\", \"Address\" : \"";
    echo $row["Address"];
    echo "\" }";
}

$conn->close();
?>
more whitepapers