Skip to content

Instantly share code, notes, and snippets.

@garbados
Created June 24, 2013 21:41
Show Gist options
  • Save garbados/5853858 to your computer and use it in GitHub Desktop.
Save garbados/5853858 to your computer and use it in GitHub Desktop.
Example of pushing data to a Geckoboard widget. Based on this documentation: http://docs.geckoboard.com/custom-widgets/push.html Specific to the "numbers" widget. Find more widget specs here: http://docs.geckoboard.com/custom-widgets/index.html#types
var config = require("./config")
, request = require("request")
, i = 0;
function ping(){
request.post({
url: config.push_url,
json: {
api_key: config.api_key,
data:{
item: [{
// value, which is...
text: "",
value: i
},{
// ...relative to this value
text:"",
value: 100
}]
}
}
}, function(e, r, b){
if(e) throw e;
console.log(b);
i++;
});
}
// push data every second
setInterval(ping, 1000);
{
"push_url": "https://push.geckoboard.com/v1/send/...",
"widget_key": "...",
"api_key": "..."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment