Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jklingsporn/vertx-push-onesignal
Send push notifications asynchronously in your vertx application with OneSignal.
https://github.com/jklingsporn/vertx-push-onesignal
java onesignal onesignal-notifications push-notifications vertx
Last synced: 25 days ago
JSON representation
Send push notifications asynchronously in your vertx application with OneSignal.
- Host: GitHub
- URL: https://github.com/jklingsporn/vertx-push-onesignal
- Owner: jklingsporn
- License: mit
- Created: 2017-01-10T12:37:26.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T20:55:17.000Z (about 4 years ago)
- Last Synced: 2024-09-28T16:23:08.910Z (about 1 month ago)
- Topics: java, onesignal, onesignal-notifications, push-notifications, vertx
- Language: Java
- Homepage:
- Size: 44.9 KB
- Stars: 15
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- vertx-awesome - Onesignal - Send push notifications to (mobile/web) apps from your Vert.x application with [OneSignal](https://onesignal.com/). (Integration)
README
# vertx-push-onesignal
Send push notifications asynchronously in your [vertx](http://vertx.io/) application with [OneSignal](https://onesignal.com/).#### Example
```
//Create a client. You get the APP_ID and API_KEY from the OneSignal-dashboard
PushClient.create(Vertx.vertx(), "YOUR_APP_ID", "YOUR_API_KEY").
//setup the content of the message on the serverside
withContent(new JsonObject().put("en", "English Content.").put("de","Deutscher Inhalt.")).
//all users should receive this
targetBySegments(Segments.ALL).
sendNow(
h -> {
if (h.succeeded()) {
System.err.println(h.result().encodePrettily());
} else {
h.cause().printStackTrace();
}
});
```More examples can be found in the [``Examples``](https://github.com/jklingsporn/vertx-push/blob/master/src/main/java/io/github/jklingsporn/vertx/push/examples/Examples.java)-class.
#### Why would I use this library over writing my own CURL?
Sure you can do this. What this library gives you on top is validation. When writing your own request it is absolutely
fine to both target users by segments and filters. This library makes sure that you only use one targeting parameter.
Also the content of a message can either be defined by using templates _or_ setting the content like in the example above, this
library lets you set exactly one way to deliver messages.**Filters**
Targeting users using filters can be tricky when writing your own CURL call. You have to remember which relation can be used
for which filter. This library only lets you use the relations that are allowed for a given filter:```
//using a filter to target only users that haven't used the app for 24 hours
Filters.lastSession().greater(24); //OK
Filters.lastSession().less(24); //OK
Filters.lastSession().exists(24); //Compiler-error//Combining filters using OR
Filters.lastSession().greater(24).or(Filters.sessionCount().equal(1));
...
```# requirements
To use this library you need to create a [OneSignal](https://onesignal.com/)-account and configure your clients (web or mobile) accordingly.# maven
```io.github.jklingsporn
vertx-push-onesignal
1.9```
# disclaimer
The author has no connection to the companies behind OneSignal or Vertx. This library also comes without any warranty - just take
it or leave it.