Git Product home page Git Product logo

aerogear-unifiedpush-nodejs-client's Introduction

AeroGear UnifiedPush Node.js Client

CircleCI Coverage Status npm License

Node Sender API for the AeroGear Unified Push server

This version of the sender is compatible with the 1.1.x series of the UnifiedPush Server_

Project Info
License: Apache License, Version 2.0
Build: npm
End User Documentation: https://docs.aerogear.org
Community Documentation: https://aerogear.org
Issue tracker: https://issues.jboss.org/browse/AEROGEAR
Mailing lists: https://groups.google.com/forum/#!forum/aerogear

Getting Started

Add the dependency to your project:

npm i unifiedpush-node-sender

Usage

Create a sender

const agSender = require('unifiedpush-node-sender');

const settings = {
    url: '<pushServerURL e.g http(s)//host:port/context>',
    applicationId: '<pushApplicationId e.g. 1234456-234320>',
    masterSecret: '<masterSecret e.g. 1234456-234320>'
};

First get a handle on the client object, then use the client.sender.send method to send a message

agSender(settings).then((client) => {
    client.sender.send(message, options).then((response) => {
        console.log('success', response);
    })
});

Similar to the send method but passing an array of {message, options} objects as parameter instead.

agSender(settings).then((client) => {
    client.sender.sendBatch(messages).then((response) => {
        console.log('success', response);
    })
});

API Documentation

Class: Sender

The Sender Class, It returns a Promise with the client object

Sender(settings)

  • settings Object
    • url String - The URL of the Unified Push Server.
    • applicationId String - The id of an Application from the Unified Push Server
    • masterSecret String - The master secret for that Application
    • headers Object - The hash of custom HTTP headers / header overrides

client.sender.send([message], [options])

  • message Object

    • alert String - message that will be displayed on the alert UI element
    • priority String - sets a processing priority on a push message. values can be 'normal' or 'high'
    • sound String - The name of a sound file
    • badge String - The number to display as the badge of the app icon
    • userData Object - any extra user data to be passed
  • message.apns Object

    • title String - A short string describing the purpose of the notification.
    • action String - The label of the action button
    • urlArgs Array - an array of values that are paired with the placeholders inside the urlFormatString value of your website.json file. Safari Only
    • titleLocKey String - The key to a title string in the Localizable.strings file for the current localization. iOS Only
    • titleLocArgs Array - Variable string values to appear in place of the format specifiers in title-loc-key. iOS Only
    • actionCategory String - the identifier of the action category for the interactive notification
    • contentAvailable Boolean - Provide this key with a value of 1 to indicate that new content is available. iOS Only
  • message.windows Object

    • type String - The type of message to send toast, raw, badge or tile.
    • duration String - Duration a Toast message is displayed 'long' or 'short'
    • badge String - Badge notifications type for badges that are not numbers (none, activity, alert, available, away, busy, newMessage, paused, playing, unavailable, error or attention), for numbers use the value in the main part of the message.
    • tileType String - Different type of tile messages with different sizes see the [tile template catalog]{@link https://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx} e.g. 'TileSquareText02' or 'TileWideBlockAndText02'
    • images Array - Images either local or remote need match the nubmer of the tileType
    • textFields Array - Texts needs to be same as the number of the tileType
  • options Object

  • options.config Object

    • ttl Number - the time to live in seconds. This value is supported by APNs and GCM Only
  • options.criteria Object

    • alias Array - a list of email or name strings
    • deviceType Array - a list of device types as strings
    • categories Array - a list of categories as strings
    • variants Array - a list of variantID's as strings

License

See LICENSE file

Questions?

Join our user mailing list for any questions or help! We really hope you enjoy app development with AeroGear.

Found a bug?

If you found a bug please create a ticket for us on Jira with some steps to reproduce it.

aerogear-unifiedpush-nodejs-client's People

Contributors

camilamacedo86 avatar danielpassos avatar edewit avatar evanshortiss avatar josemigallas avatar lfryc avatar lholmquist avatar matzew avatar secondsun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.