[OneSignal Notification Plugin] Ideas for OneSignal Plugin: SendTag, PostNotificationToUser, PostNotificationToTag

[OneSignal Notification Plugin] Ideas for OneSignal Plugin: SendTag, PostNotificationToUser, PostNotificationToTag

  
Forge Component
(5)
Published on 2016-12-14 by Alexandre Costa
5 votes
Published on 2016-12-14 by Alexandre Costa

Hi, I have been customizing this OneSignal Plugin for my purposes, but I figured this may also help other users if implemented officially.


On OneSignalPlugin:

1. add new public Client-side Logic named "SendTag" with JS:

window.plugins.OneSignal.sendTag($parameters.key, $parameters.value);


2. on RegisterDevice logic, add new JS after RegisterDevice JS:

window.plugins.OneSignal.sendTag("userid", $parameters.UserId);


On OneSignalApi:

1. add new public Server-side Logic named "PostNotificationToUser", which send notification based on "userid" tag.


2. add new public Server-side Logic named "PostNotificationToTag", which send notification based on specific key-value tag.


Currently I have problem attaching picture, I will attach some picture as soon as I can.

Hello Harlin thanks for your contribution. I will insert your code. Outystems will launch a official OneSignal plugin soon. So my plugin will be renamed but is still avaiable and can be customized.


Harlin Setiadarma wrote:

Hi, I have been customizing this OneSignal Plugin for my purposes, but I figured this may also help other users if implemented officially.


On OneSignalPlugin:

1. add new public Client-side Logic named "SendTag" with JS:

window.plugins.OneSignal.sendTag($parameters.key, $parameters.value);


2. on RegisterDevice logic, add new JS after RegisterDevice JS:

window.plugins.OneSignal.sendTag("userid", $parameters.UserId);


On OneSignalApi:

1. add new public Server-side Logic named "PostNotificationToUser", which send notification based on "userid" tag.


2. add new public Server-side Logic named "PostNotificationToTag", which send notification based on specific key-value tag.


Currently I have problem attaching picture, I will attach some picture as soon as I can.



That's great news, I hope it will have SUPPORTED status.

Anyway, I've attached my own modification of your OneSignal Plugin, I hope it can help someone...