This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
boxcar with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
This is a node.js non-blocking API consumer for the BoxCar push notification service. BoxCar Api is an EventEmitter that emits 'response' on completion. You can push notifications as yourself (a user) or as a provider.
$ npm install boxcar
$ git clone firstname.lastname@example.org:devdazed/boxcar-api.git
##Basic Usage The constructor takes 2 arguments, the fist is your Provider Key, the second is your secret key. Your secret key is only required if using 'broadcast' or 'notifyService'
var boxcar = require('boxcar'); var provider = new boxcar.Provider('your_provider_key', 'your_provider_secret'); //to brodcast a message to your all of the users in your service provider.broadcast('This is a test', 'FooBar'); //send a message to a user directly provider.notify('email@example.com', 'Hi FooBar!'); //subscribe a current boxcar user to your service provider.subscribe('firstname.lastname@example.org'); //to send yourself messages you can use the user api var user = new boxcar.User('email@example.com', 'your_boxcar_password'); user.notify('Hai Me!');
##Advanced Usage When using notify and broadcast you can specify additional parameters, an explanation of parameters is below. ###Provider.subscribe(email) Subscribes a boxcar user to your service ###Provider.notify(email, message, fromScreenName, fromRemoteServiceId, redirectPayload, sourceUrl, iconUrl) Sends a notification to a specific user ###Provider.broadcast(message, fromScreenName, fromRemoteServiceId, redirectPayload, sourceUrl, iconUrl) Sends a notification to all users in your service ###User.notify(message, fromScreenName, fromRemoteServiceId, sourceUrl, iconUrl) To use the User API, you must first install the boxcar Growl service.