Skip to content

Latest commit

 

History

History
162 lines (117 loc) · 5.1 KB

README.md

File metadata and controls

162 lines (117 loc) · 5.1 KB

Pushover for Minoss

GitHub version NPM version Dependency version

This module adds support for Pushover notifications to Minoss server. The API communication is based on pushover-notifications.

Table of Contents


Installation

Inside your Minoss root folder just use npm to install this Module.

$ npm install minoss-pushover

Configuration

By default there are two configuration files available inside the config/ folder: apps and messages. The configuration for messages is optionally. It is possible to store different predefined message objects there, if wanted. For more details take a look inside the files or read about the message builder.

Before using this module the apps configuration should be set up. This file contains the user_key and app_token for all pushover apps where notifications should be send to.

It is possible to store the apps under own names. The name default is a reserved name. It will select this app whenever no app name was given by request parameters. So, if only one app is available, the name default should be used.

module.exports = {
    default: {
        user:  '14a6b88846b28898a237fa3f84148f54',
        token: '30f28fcb0c97083d20a8cd06f3f6e737'
    },
    another: {
        user:  '85b9e76dc041b411b04b5c1f49cba885',
        token: '8d0771a0757289d942db83db090623d6'
    }
};

Basic Usage

The basic usage is pretty simple. When a default app is defined just call the send script with a supplied message string to be send. For more parameters take a look at the pushover api or the parameter shorthands.

http://localhost:8080/pushover/send?message=my%20custom%20message

Parameter Shorthand

All request parameters can be shorten to it's first character (except url_title and timestamp, which are shorten with ut and ts). With this it is possible to use shorten URLs.

app        ->  a
message    ->  m
device     ->  d
title      ->  t
url        ->  u
url_title  ->  ut (!)
priority   ->  p
timestamp  ->  ts (!)
sound      ->  s

Example:

http://localhost:8080/pushover/send?**app**=default&**priority**=1&**device**=*
http://localhost:8080/pushover/send?**a**=default&**p**=1&**d**=*

Message Builder

Pushover messages are basically a JavaScript object. It is possible to set all the options of the official api via request parameters. But is is even possible to let these message objects build on request.

Messages can be predefined in configuration. If there are messages configured they can be send by it's name on request:

http://localhost:8080/pushover/send?message=**name**

Using JSON as Message Object

It is possible to use a JSON string as message object on request. It works the same way as with predefined messages:

http://localhost:8080/pushover/send?message=**{"message":"my message","device":"*"}**

Chaining Messages

The message builder can even handle a chain of messages. These messages has to be separated by a pipe | on request. It will combine all messages in the given order. When a message property is set by more than one entry, the last one will be set.

For example, these are predefined states:

let messages = {
    default: {
        device: '*',
        priority: 0
    },
    high: {
        priority: 1
    }
}

And this request:

http://localhost:8080/pushover/send?message=**default|high|my%20message%20text**

The resulting message object would become:

{
  message: 'my message text',
  device: '*',
  priority: 1
}

It is even possible to chain a JSON string too.

http://localhost:8080/pushover/send?message=**default|high|{"message":"my message"}**

Bugs / Feature request

Please report bugs and feel free to ask for new features directly on GitHub.

License

Minoss is dual-licensed under MIT and GPL-2.0 license.

Donation

You like to support me?
You appreciate my work?
You use it in commercial projects?

Feel free to make a little donation! 😉