0.4.1 • Published 10 years ago

urban-airship v0.4.1

Weekly downloads
332
License
MIT
Repository
github
Last release
10 years ago

#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) {....});

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

11 years ago

0.2.5

11 years ago

0.2.4

12 years ago

0.2.3

12 years ago

0.2.2

12 years ago

0.2.1

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago