Echolo

The Echolo Developer Hub

Welcome to the Echolo developer hub. You'll find comprehensive guides and documentation to help you start working with Echolo's IoT Platform as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Start with Webhooks

Webhooks are "user-defined HTTP callbacks". They are usually triggered by some event, such as an update to a hub or device. When that event occurs, the source site makes an HTTP request to the URL configured for the webhook. Users can configure them to cause events on one site to invoke behavior on another. The action taken may be anything. Since they use HTTP, they can be integrated into web services without adding new infrastructure.

Before moving on

Please review the types of data payloads you can receive from a webhook and what type of events are monitored on our platform.

1) Create a Webhook

To get started to allowing the Echolo Platform to start pushing data to your callback you first want to have your callback url well tested and ready to go.

Test your callback with real data!

In the Webhook Events docs you will notice the 'REST Equivalent', using the REST API response data from the REST Equivalent endpoint to send to your url via POSTMAN or other. This will result in a valid test if your callback does not fail and responds with the expected outcome.

1.1) Make the Request

Let's make a requests to create a new webhook using the dataType device_hook, so each time the platform gets an update for any device attached to my appId I will get a callback to my url.


var options = { method: 'POST',
  url: 'https://api.echolo.io/v1/webhook',
  headers: 
   { 'x-api-key': 'x-api-key',
     token: 'token',
     'app-id': 'app-id' },
  body: {
  	dataType: 'device_hook',
    url: 'http://myurl-app.com/callback'
  } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

2) Getting the data

Each time the platform event fires my call back will get the following data:

{
    "packet": "0201061AFF4C000215699EBC80E1F311E39A0F0CF3EE3BC0120001FCC7C1",
    "measuredDistance": 2,
    "nodeId": "CC:11:88:EE:11:DD",
    "rangeGuess": "0 6",
    "appId": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
    "lastSeenDate": "Tue Aug 29 04:44:36 2017",
    "rssi": -40,
    "name": "(unknown)",
    "seenAt": "FMyHub12"
}

Not getting data?

Please make sure to test your callback and ensure that it is fully working. You can also use an AWS Lambda service to dumb the platform data to a log file to ensure that your JSON structure is correct.