Push notification server for Discourse powered by Herrd
$ git pull [email protected]:Herrd/herrd-push-server.git
$ npm install
$ npm install -g knex
$ npm install -g bower
$ knex migrate:latest
$ bower install
$ DEBUG=herrd-push-server:* ./bin/www
If you'd like to restart the server with each file change, install nodemon:
$ npm install -g nodemon
$ DEBUG=herrd-push-server:* nodemon bin/www
Either way, the server will now be running at http://localhost:3000/.
We use dotenv to simplify environment variable configuration.
To get started quickly, simply:
$ cp .env.sample .env
And update the values in .env
All administrative pages (such as /apps/
) require authentication.
The first user can be created by going to /auth/signup
. After that, the sign up page will only work for logged in users.
Each API call requires an api_key
parameter. This API key is associated directly to a Discourse forum. API results will reflect actions directly for that Discourse forum - no need to pass in the hostname each time.
Lists all players associated with a Discourse forum
api_key
- The API Key
$ curl https://push.herrd.io/api/players?api_key=abc123
Send a notification. A notification is sent to all devices registered for the provided user.
api_key
- The API Keyuser_id
- The Discourse user ID of who should receive the notificationcontents
- The object of contents to send
Data can be sent via JSON body or x-www-form-urlencoded
$ curl https://push.herrd.io/api/send \
-d api_key=test \
-d user_id=1 \
-d contents[en]="hello world"