io.github.jklingsporn:vertx-push-onesignal

Send push notifications asynchronously in your Vertx application with OneSignal.

License

License

GroupId

GroupId

io.github.jklingsporn
ArtifactId

ArtifactId

vertx-push-onesignal
Last Version

Last Version

2.2
Release Date

Release Date

Type

Type

jar
Description

Description

io.github.jklingsporn:vertx-push-onesignal
Send push notifications asynchronously in your Vertx application with OneSignal.
Project URL

Project URL

https://github.com/jklingsporn/vertx-push-onesignal
Source Code Management

Source Code Management

https://github.com/jklingsporn/vertx-push-onesignal

Download vertx-push-onesignal

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.jklingsporn/vertx-push-onesignal/ -->
<dependency>
    <groupId>io.github.jklingsporn</groupId>
    <artifactId>vertx-push-onesignal</artifactId>
    <version>2.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.jklingsporn/vertx-push-onesignal/
implementation 'io.github.jklingsporn:vertx-push-onesignal:2.2'
// https://jarcasting.com/artifacts/io.github.jklingsporn/vertx-push-onesignal/
implementation ("io.github.jklingsporn:vertx-push-onesignal:2.2")
'io.github.jklingsporn:vertx-push-onesignal:jar:2.2'
<dependency org="io.github.jklingsporn" name="vertx-push-onesignal" rev="2.2">
  <artifact name="vertx-push-onesignal" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.jklingsporn', module='vertx-push-onesignal', version='2.2')
)
libraryDependencies += "io.github.jklingsporn" % "vertx-push-onesignal" % "2.2"
[io.github.jklingsporn/vertx-push-onesignal "2.2"]

Dependencies

compile (2)

Group / Artifact Type Version
io.vertx : vertx-core jar 3.7.1
io.vertx : vertx-web-client jar 3.7.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

vertx-push-onesignal

Send push notifications asynchronously in your vertx application with OneSignal.

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-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-account and configure your clients (web or mobile) accordingly.

maven

<dependency>
  <groupId>io.github.jklingsporn</groupId>
  <artifactId>vertx-push-onesignal</artifactId>
  <version>1.9</version>
</dependency>

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.

Versions

Version
2.2
2.1
2.0
1.9
1.8
1.7
1.6
1.5.0
1.4.0
1.3.0
1.2.0
1.0.0