Skip to content
Simple wrapper for the Urban Airship API in Node.js.
JavaScript
Failed to load latest commit information.
lib Changed usage examples in README to fit v3 API and added two helper f… Aug 19, 2014
test Added stefano to contributors, bumped version. Added a stub test to t… Aug 20, 2014
.gitignore Added stefano to contributors, bumped version. Added a stub test to t… Aug 20, 2014
.travis.yml I solemnly swear there are no tabs left. Aug 20, 2014
README.md Travis CI button, because why not? Aug 20, 2014
index.js Init Dec 1, 2011
license.txt
package.json Added stefano to contributors, bumped version. Added a stub test to t… Aug 20, 2014

README.md

node-urban-airship

NPM version Build Status

Simple wrapper for the Urban Airship API.

Installation

npm install urban-airship
var UA = require("urban-airship");
var ua = new UA("<api key>", "<api secret key>", "<api master key>");

Testing

Tests use the mocha library listed in devDependencies.

npm test

Usage

Sample API Calls

  1. Register a device

    ua.registerDevice("< token >", function(error) {...});

  2. Create payloads for the push notification API needed.

    Information available here. http://urbanairship.com/docs/push.html

    Push Notification Examples (API v3):

    a)  "/api/push/"
    
            var payload0 = {
              "audience": {
                "device_token": A single device token identifier
              },
              "notification": {
                      "ios": { specific options for iOS devices},
                      "android": { specific options for Android devices},
          "alert": "The push text to send to devices"
              },
              "device_types" : "all"
            };
    
    ua.pushNotification("/api/push", payload0, function(error) {....});
    
    b) "/api/push/"
    
            var payload0 = {
              "audience": "all",
              "notification": {
                      "ios": { specific options for iOS devices},
                      "android": { specific options for Android devices},
          "alert": "The push text to send to devices"
              },
              "device_types" : "all"
            };
    
    ua.pushNotification("/api/push/", payload1, function(error) {.....});
    
  3. Unregister a device.

    ua.unregisterDevice("< token >", function(error) {....});

Something went wrong with that request. Please try again.