Socket
Socket
Sign inDemoInstall

node-adm

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-adm

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


Version published
Maintainers
1
Install size
21.5 kB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 20 Mar 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc