[OneSignal Plugin] Sending wrong datetime to onesignal?

[OneSignal Plugin] Sending wrong datetime to onesignal?

  
Forge Component
(5)
Published on 6 Oct (2 weeks ago) by OutSystems R&D
5 votes
Published on 6 Oct (2 weeks ago) by OutSystems R&D

Hi all,

Hi have noticed when I'm sending a notification using "SendPushNotificationToUserId" action from the "OneSignalAPI" and leave the "Send After" input empty (by default use the CurrDatetime()" ) the notification it's sent well but received in OneSignal webpage as scheduled for the next hour, it's seems there is a "gap" of one hour from OS Server and OneSignal. How should we handle this? We need to set the "SendAfter" input with CurrDatetime()-1h to the notification be sent on "realtime"? Doesn't make to much sense to me.

Thank you for advice on this.

Cheers


Hey, Gonçalo,

That's odd: I just tested sending one using the exact same method and it worked (called the same action with my own user identifier). I even turned on the Integration logs to check if the times sent to the API matched the server time.

This leads me that your scenario may be different. Are you using an on-premises installation? If so, is the server configured for UTC? Is the test device you are using on a timezone different that GMT+1? If so, can you check the value sent to OneSignal's API? (you can do this by debugging the plugin code or probably through the dashboard)

Please let us know how it went or if you need further help.

Thanks in advance,

Carlos Simões

Hi Carlos,

thank for your fast feedback! 

We are using a cloud environment and I can confirm that the hour in our service center it's correct GMT+1 (UK).

The device i'm using it's UTC configured (UK as well). I already tried to debug the API espace but because I'm using it in a third level App-AppLibrary-OneSignal for some reasons I couldn't debug the API method that I'm using.

On the logs I can see that the method it's sending the correct datetime but on the OneSignal Portal the "SendDate" appear as one hour plus GMT+1

I attached some print screens that maybe can help explain what the behavior I'm getting.

Thank you for your help.

Cheers

 


Solution

Regarding debugging, you can always refresh references across all modules before attempting a debug session. The most surefire way to do it is to create and publish a solution that includes the app module and its dependencies.

Concerning the initial problem, it looks like it's related to the fact that the server is not configured for UTC, which is what OneSignal's API expects, when no timezone is specified. You can work around the issue, like you suggested, by adjusting the time manually, before calling the action. You may want to try the Google Maps component, which includes some timezone conversion actions.

But I agree: that sounds like an awkward default. I'll pass on the feedback to the team for revision.

Thanks for pointing it out! Feel free to reach out if you need to add anything else or have additional questions!

Carlos Simões

Solution

I implemented the workaround discussed (-1 hour) and all works as expected now.

I also did a quick look on the API documentation and there are some different options to populate that value, so I think would be a quick and easy one to solve for R&D team just identify what's the current timezone running on the server and built the proper value when the "SendAfter" option his left blank. Another idea is give the option to the end user pass the timezone we wants because it's also a optional field available on the OneSingle API:

Thank you for all your help Carlos.

Cheers