Push Notifications API
Push Notifications API is a simple Android app for displaying notifications on your phone through a REST-API. Using a Node server with server sent events.
It is a tool for developers that need a easy way to post notifications to their phone. The application requires an API to handle all the notifications. There is a working example of a Node server in the server folder that works with the Android app.
The application is great for IoT (Internet of Things). You could for example post a notification to your phone every time your garden needs watering when a sensor has detected the level of soil moisture to be low. The possibilites are up to you!
You can download the Android app through Google Play or download the latest apk from the releases.
In the configuration tab type in the /events
endpoint on your server
You can find the IP-address in the server log
If you haven't already, install Node.
git clone [email protected]:viktorholk/push-notifications-api.git
cd push-notifications-api
npm i
npm start
The app will by default run on port 3000 and the endpoint for the notification events are /events
The port can be changed in the server/.env
file
Replace 127.0.0.1:3000
with your IP and port
POST http://127.0.0.1:3000
Example Curl
curl '127.0.0.1:3000' \
--header 'Content-Type: application/json' \
--data '{
"title": "Foo Bar Baz!",
"message": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"url": "http://example.com",
"icon": "suitcase.png",
"color": "#1554F0"
}'
Property | Type | Description | Required |
---|---|---|---|
title | String | The title of the notification | Yes |
message | String | The longer text that will be included in the notification | No |
url | String | Open the URL on notifcation press | No |
icon | String | 24x24 icon file located in server/src/icons |
No |
color | String | Customize the notification color. See supported colors | No |
Created 201
GET http://127.0.0.1:3000
[
{
"title": "Foo Bar Baz!",
"message": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"url": "http://example.com",
"icon": "base64encoded...",
"color": "#1554F0"
},
...
]
GET http://127.0.0.1:3000/latest
{
"title": "Foo Bar Baz!",
"message": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"url": "http://example.com",
"icon": "base64encoded...",
"color": "#1554F0"
}
Notifications are not showing up
Make sure notifications are enabled in your settings
Settings > Notifications > App notifications
Please report issues using GitHub's issues tab.
Push Notifications API is under the MIT LICENSE.