JSPM

node-adm

0.9.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12448
  • Score
    100M100P100Q129336F

a Node.JS wrapper for Amazon Device Messaging for Kindle devices (ADM)

Package Exports

  • node-adm

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-adm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-adm

node-adm is a Node.JS library for Amazon Device Messaging for Kindle.

Notes

  • Automatically performs the OAuth2 access token fetch on send
  • Will re-authenticate itself once the token expires
  • Loosely based on node-gcm

Usage

var adm = require('node-adm');

var registration_id = YOUR_REGISTRATION_ID;

var options = {
  client_id: YOUR_ADM_CLIENT_ID,
  client_secret: YOUR_ADM_CLIENT_SECRET
};

var admSender = new adm.Sender();

var messsage = {
  data: {
    message: "Hello"
  },
  consolidationKey: "Some Key",
  expiresAfter: 86400      
}
admSender.send(messsage, registration_id, function(err, result) {
  if (err) {
    // No recoverable error
    console.log(err);
    process.exit(1);
    return;
  }
  if (result.error) {      
    // ADM Server error such as InvalidRegistrationId
    console.log("Error: " + result.error);
  } else if (result.registrationID) {
    console.log("Success, current registration ID: " + result.registrationID);
  }
  process.exit(0);
})

Contribute!

Send us a pull request if you see bugs or have suggestions!

Licence

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Changelog

0.9.1: 03/20/2014

  • initial release