[OneSignal Plugin] Troubles implementing OneSignal

[OneSignal Plugin] Troubles implementing OneSignal

  
Forge Component
(9)
Published on 19 Oct by OutSystems R&D
9 votes
Published on 19 Oct by OutSystems R&D

Hi all,

i have some problems implementing OneSignal, would appreciate any help,

I am creating an Attendance Application, and the app is supposed automatically sent out notifications everyday at 8am.

This is what i did (i followed the OneSignal tutorial):

- Put the "RegisterWithUser" action under Login has shown in the OneSignal article

- Have also put the OneSignal plugin under my layout, what should i put for my Handler?

I tried onReady for both events (OnNotificationOpened & onNotifcationRecieved) to no avail., i also have tried to create a new action that redirects the user back to the app homescreen and put it under the handler for (OnNotificationOpened & onNotifcationRecieved) to no avail too.



- I have also created a admin page, where admin can press the "SENT NOTIFICATION" button to sent out notification to all users


- "SENT NOTIFICATION" button calls the Notification Server action below


- When i publish my app and try to access the admin page to sent out notification (first screenshot), i get this error instead....

i tried if i remove the OneSignal plugin for my layout i won't have this error and will be able to access the admin page



Am i missing out anything? I still cannot sent out any notifications....

Also, when i login to OneSignal website i see this:


Does this mean i have not finish setting up? Do i need to subscibe a user because i when i see under my user page i just see this, 0 users....


Have also uploaded my oml.....so it would be really great if anybody could help me.

Thank you!

Hey Wei,


As for the first screen (Login)

Please use the check one signal plugin action and put a condition relevant to that, so that we can find whether it has the plugin or not.


I checked your OML since it was developed on your personal, I can't test that.

But the implementation that you did was correct.

Me too using the same plugin to send the notification, its working perfect for my application.

please regenerate the application and test that one more time. also please try that in some other device.

if the problem still exists, Use a breakpoint to find where the exact problem is arising.


Let me know once you finish doing this


Thanks,

Keerthi

Solution

Hi Wei, 

One Signal uses Cordova plugins, so it you have to check first on the device type. 


I have faced this problem before, what is causing it that you need to make a check on the block in the layout  


- make a function in the layout preparation GetOperratingSystems



and use it like this in the layout block 


I hope this is what you looking for 


Cheers,
Mohamed AlMokadem

Solution

Hello, Wei,

Complementing the other answers, for the handlers, it depends on what you're trying to achieve.

You say you want to send notifications at 8 am, every day. If you're only looking for Android/iOS notifications when users have the app closed, then you should have everything set up by now.

If you want to react to a user tapping that notification (which opens the app) or if they have the app opened, that's when you will need the NotificationClicked and NotificationReceived handlers, respectively. Using those handlers, you can read information from the notification that was received and let your logic decide on it: show a feedback message? Silently store a record on the database?

Hope that clears up how the notifications work with the plugin.

Best regards,

Carlos Simões

Mohamed ElMokadem wrote:

Hi Wei, 

One Signal uses Cordova plugins, so it you have to check first on the device type. 


I have faced this problem before, what is causing it that you need to make a check on the block in the layout  


- make a function in the layout preparation GetOperratingSystems



and use it like this in the layout block 


I hope this is what you looking for 


Cheers,
Mohamed AlMokadem

Hi AlMokadem,


Thank you for the reply :) 

Just wondering, how do you create the "GetOperatingSystems" function under the layout.. i can only see "Add Client Action" is that how i add it? and also i see you call something called "CurrentOS" where do i call that?


After doing this, I just have to add the OneSignalPlugin into my layout block then notification should be able to run already right?

So i will sent my notification through accessing the OneSignal website and logging in through the website to sent notifications out to my users?

Is that how it works?

Sorry for my late reply, really appreciate any help :D

Hi Wei Ren, 


You will find the CurrentIOS function in the web patterns 


creating the GetOperatingSystems, use Fetch Data from other sources to do it. 


I hope this helps.

Cheers,

Mohamed AlMokadem


Mohamed ElMokadem wrote:

Hi Wei Ren, 


You will find the CurrentIOS function in the web patterns 


creating the GetOperatingSystems, use Fetch Data from other sources to do it. 


I hope this helps.

Cheers,

Mohamed AlMokadem


Hi AlMokadem,

Thank you so much for your response, i can finally sent notification through the OneSignal website to my subscribed users..:DD

Another question, in my post earlier i have indicated that i wish to sent out daily automated notification to my users everyday at say 8am. How do i do that?

I see that there is a "NEW AUTOMATIC MESSAGE" function but i don't see how i can schedule my notification to be sent out daily. Any idea on this?


Hello, Wei,

Not sure if you could do it via the OneSignal dashboard (tried it myself but couldn't), but it does look doable using OutSystems.

You just need to implement a timer running every day, which calls the "SendPushNotificationToX" action from the "OneSignal API" module.

Can you have a go at it and let us know how it went?

Thanks and best regards,

Carlos Simões