Add Ducksboard.gs
(using .js here to enable syntax hilighting) to your Apps Script project, and instantiate a new instance in your main function:
var ducks = new Ducksboard('YOUR_API_KEY');
Send the number 42 to the slot at 181242 (works for boxes, pins, guages, bars, etc.):
ducks.send_number(181242, 42);
Send an item to a timeline at 181243 with a title of "Test", content "foo bar", and my github avatar omitting the optional link parameter:
ducks.send_timeline_update(181243, 'Test', 'foo bar', 'https://secure.gravatar.com/avatar/6e585eb21989377a2669d19cca43f40d');
Send another type of update to other types of slots as documented by the Ducksboard API:
var funnel_update = {
"value": {
"funnel": [
{"name": "STEP 1", "value": 1600},
{"name": "STEP 2", "value": 1400},
{"name": "STEP 3", "value": 1200},
{"name": "STEP 4", "value": 900},
{"name": "STEP 5", "value": 600},
{"name": "STEP 6", "value": 330}
]
}
}
ducks.send(181244, funnel_update);