Scanning API Receiver with NodeJS
A simple NodeJS application to accept WiFi and BLE location data from a Cisco Meraki network.
How it works
Meraki will first verify the intended receiver by sending a GET request to this server and expect to receive a validator key.
If validated, Meraki will periodically send a JSON stream of location data approx every 1-2 minutes.
The JSON data will contain a secret that can be verified by the receiver (this app) to ensure the data is from the correct sending network.
Once the data has been received, it is sent to the cmxData(data) function, where the JSON data will be in the data object.
This example simply prints the contents to the console. Ideally, this would be sent to a database or trigger a workflow.
Install
(You will need NodeJS installed before beginning)
Clone the repository, change into it and install the dependencies.
git clone https://github.com/dexterlabora/cmxreceiver.git
cd cmxreceiver
npm install
Configuration
Modify the cmxreceiver.js file with your correct service port, secret, validator.
Then, do something with the data (i.e write to database) by modifying this function:
function cmxData(data){
console.log("JSON Feed: "+JSON.stringify(data, null, 2));
};
Run
node cmxreceiver.js
Alternatively, you can define the parameters at runtime using environment variables (except for the DB piece) by typing this at the shell.
VALIDATOR="8e0846499d9a3f6c23f7868c4cFFFFd63250FFFF" SECRET="testing123" node cmxreceiver.js
Default post URL