Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 954 Bytes

File metadata and controls

64 lines (48 loc) · 954 Bytes

notifier-client

Simple client for https://github.com/likeastore/notifier

Usage

Install from npm,

$ npm install notifier-client

Initialize the client,

var notifier = require('notifier-client')({
	host: 'notifier.example.com',
	token: '3943fa9c7eb8b13071582910e76d737e1bf91abe'
});

Use the notify method,

notifier.notify({
	event: 'user-resistered',
	user: 'a@a.com',
	data: {registered: new Date() }
}, function () {
	// notified!
});

Or use to and withData methods,

notifier.notify('user-registered')
	.to('a@a.com')
	.withData({registered: new Date() })
	.send(function () {
		// notified!
	});

In both cases callback parameter is optional,

notifier.notify({
	event: 'user-resistered',
	user: 'a@a.com',
	data: {registered: new Date() });

// or

notifier.notify('user-registered')
	.to('a@a.com')
	.withData({registered: new Date() })
	.send();

License

MIT