hiku, getting started

hiku, getting started

Developing an application for the hiku is not too difficult. What you need is the following:

  • a hiku
  • a publicly accessible server that runs an https server and your flavor of programming language (I am using php)
  • a phone or tablet
  • an app id with matching secret

You can buy a hiku online, either with hiku directly or through Amazon. Having access to a webserver that runs https (secure http) is not hard to come by. If you do not have this yet, I am sure you can google this. You need a phone or tablet with you can use to run the hiku app. You need the app to program the wifi credentials into the hiku. Finally you need to get an app id and matching secret from hiku. I will get to that later.

I am going to assume you have your hiku now, you have access to an http server where you can put your code and a phone or tablet with the hiku app. For iOS this is the link. So far the iOS app is only available in the US store. The documentation for setting up your hiku can be found on the hiku website along with some other support articles.

Once you are set up, try scanning some products. The hiku database should recognize a lot of US products but if you are not in the US, it might not recognize your local products. When you scan an unknown product you can add it yourself. You should be able to scan US products like the jar of Nutella:

http://hier.familiebenda.nl/global.j-tools.net/Includes/Barcode/barcode.php?code=80050865&scale=1.6

Scanning from my laptop screen did not work but you should be able to scan from your phone or tablet.

Once you are famliar with scanning, it is time to start your own app and get credentials. The next article will cover receiving events in detail but I would suggest creating a simple program to receive the webhooks and save the output. That way you can read back events and familiarize yourself with the contents. Also the DEVICE_REGISTERED event is only fired once for your hiku so if you save it, you can at least replay it. For now, you can use the following file and the details will be explained in the next article.

github-mark-32px Available on GitHub

<?php
//
// Set the location of your data directory
//
$dirData = "./";

//
// Retrieve the body part of the POST to our webhook
//
$postBody = file_get_contents('php://input');

//
// String with date/time for use in the filename
//
$time = strftime("%Y%m%d-%H.%M.%S");

//
// Save the body of the POST to a file
//
file_put_contents($dirData.$time.".body.txt",$postBody);

//
// Prepare a json string in the hiku format for ok
//
$json = array("response"=>array("status"=>"ok"));
$jsonstring = json_encode($json);

//
// Send the json file as response
//
header('Content-type: application/json');
print $jsonstring;
?>

Once you have uploaded this to your https server, test it to make sure it works and write down the complete url. Remember, it does not need to be index.php. In my case I use beep.php because hiku calls a scan a beep.

You are now set to ask for an app id and accompanying secret which you will need to update the shopping cart.

Send an email to devrel@hiku.us, tell them that you are developing an app, tell them what the app is supposed to do, give them the link to your webhook and the serial of the hiku that you plan to use for testing. You can find the serial in the hiku app by selecting menu, hiku (bottom left) and than clicking on your hiku’s name. Also tell them that you are ready to receive all event types (described in the next article).

When you receive an email from them with an app_id and secret, you are ready for one of the next articles in the hiku serie:

or read some of the previous articles in the hiku serie:

 

4 thoughts on “hiku, getting started

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s