You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

keen.io

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keen.io

Keen IO NodeJS module. Keen IO is a hosted API to collect, analyze, and visualize your data.

0.0.4
Source
npmnpm
Version published
Weekly downloads
304
62.57%
Maintainers
2
Weekly downloads
 
Created
Source

Keen IO - NodeJS

Build Status

Keen IO is an online service to collect, analyze, and visualize your data.

Getting Started

Use npm to install!

`npm install keen.io`

Examples

Initialization

var keen = require('keen.io');

// Configure instance. Only projectId and writeKey are required to send data.
var keen = keen.configure({
	projectId: "<project_id>",
	writeKey: "<write_key>",
	readKey: "<read_key>",
	masterKey: "<master_key>"
});

You can also have multiple instances if you are connecting to multiple KeenIO accounts in the one project (probably edge case).

var keen = require('keen.io');

// Configure instance with API Key
var keen1 = keen.configure({...});
var keen2 = keen.configure({...});

In the future there will be the ability to pass options into the initialisation such as batching inserts, etc. The structure of this hasn't been defined yet but will look something like the following.

var keen = require('keen.io');

// Configure instance with API Key and options
var keen = keen.configure({ 
	projectId: "<project_id>",
	batchEventInserts: 30 
});

Send Events

var keen = require("keen.io");
var keen = keen.configure({
	projectId: "<project_id>",
	writeKey: "<write_key>"
});

// send single event to Keen IO
keen.addEvent("my event collection", {"property name": "property value"}, function(err, res) {
	if (err) {
		console.log("Oh no, an error!");
	} else {
		console.log("Hooray, it worked!");
	}
});

// send multiple events to Keen IO
keen.addEvents({
	"my first event collection": [{"property name": "property value"}, ...],
	"my second event collection": [{"property name2": "property value 2"}]
}, function(err, res) {
	if (err) {
		console.log("Oh no, an error!");
	} else {
		console.log("Hooray, it worked!");
	}
});

Generate Scoped Key

var keen = require("keen.io");
var apiKey = "YOUR_API_KEY";
var scopedKey = keen.encryptScopedKey(apiKey, {
	"allowed_operations": ["read"],
	"filters": [{
		"property_name": "account.id",
		"operator": "eq",
		"property_value": "123"
	}]
});
var keen = keen.configure({
	projectId: "<project_id>";
	readKey: scopedKey
});

Future Updates

Future module updates are planned to introduce the remaining API calls. You can see some of the spec for that in examples/queries.js. Also, as mentioned above, specifying options when creating an instance to configure the behaviour of the instance (ie, batching event submissions).

Contributing

This is an open source project and we love involvement from the community! Hit us up with pull requests and issues.

The aim is to build up this module to completely represent the API provided by Keen IO, which is quite extensive. The more contributions the better!

Further Reading

Keen IO - Website

Keen IO - API Technical Reference

Release History

0.0.4

  • Update dependencies.

0.0.3

  • Support generating Scoped Keys.

0.0.2

  • Change error for blank write key.

0.0.1

  • Add write/read keys.
  • Reworked interface - not backwards compatible with 0.0.0!

0.0.0

  • First release.

License

Licensed under the MIT license.

Keywords

keen

FAQs

Package last updated on 22 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.