SDK to access Telemetry's API

npm install telemetry-node
3 downloads in the last week
16 downloads in the last month

Telemetry SDK for Node.js

Telemetry SDK for Node.js

This module provides connectivity between your Node project and the Telemetry data visualization service.


From npm:

npm install telemetry-node


Once installed, the module can be used by instantiating a new copy of the Telemetry.Account object:

var Telemetry = require('telemetry-node');
var account = new Telemetry.Account(apiKey, [flushTimeout], [requestUrl]);

The apiKey parameter is your API Token, while requestURL is the endpoint of the data API; if this parameter is omitted, the module points to the default API entry point automatically.

By default, the module coalesces all updates submitted to it into a single data package that is transmitted to the server every two seconds. This flushing is performed in order to minimize API usage and help to avoid running afoul of the service's rate limits.

If you prefer, you can set your own frequency by passing a different value for flushTimeout, or turn off coalescing and automatic submission by setting it to zero instead. Optionally, you can provide the module with a global callback that is run every time an update occurs:

account.flushCallback = function(err, response, body) {


The response and body parameters are populated using the HTTP response received from the server, as explained in the Telemetry API docs.

Forcing flushes

If you turn off automatic flushing, you are responsible for manually triggering flushes by calling the flush method:


The callback takes the same parameters as the flushCallback method above.

Sending updates

Whenever you want to send an update to a flow, you can use the update method:

account.update(flowName, newData);

The flowName parameter represents the name of the flow you wish to update, while newData is the corresponding payload. For example:

var telemetry = require('telemetry-node');

var account = new telemetry.account('yourApiKeyGoesHere');

        'values' : [
            'value' : Math.random() * 100000,
            'label' : 'Marco'

            'value' : Math.random() * 200000,
            'label' : 'Tabini'


The various data formats that are associated with each flow type are described in the API documentation. The module doesn't perform any checks against the data; instead, it simply sends everything over to the server.

Using automatic polling

If you wish, the module is capable of periodically executing one or more callbacks of your choice and using their result to issue updates to the Telemetry server. This is an easy way to integrate Telemetry in an existing project without having to strew calls to the module all over the place.

To start a poll, you use the poll method:

pollId = account.poll(flowName, interval, callback);

The flowName parameter indicates the name that will be updated with the result of the callback, while interval instructs the module to poll the data every so many milliseconds. To make handling multiple polls with a single closure easier, the callback takes, as its only parameter, the name of the flow that needs updating (which will be the same as the value of flowName on input). On output, poll() returns an identifier that can be used to stop the polling operation at a later date:



Support is provided through Telemetry's customer help interface. Simply log on to your account, select “Contact Us,” and drop us a note.

npm loves you