194
Views
8
Comments
Solved
[OneSignal Plugin] Onesignal. Schedule Notifications may not be scheduled in the past.
Question
onesignal-plugin
Mobile icon
Forge asset by OutSystems

I'm sending a default Onesignal 

SendPushNotificationToUserId

and I'm getting this error. Any idea how to fix? 

2020-03-10 21-01-27
Roman
Solution

Nope. I was able to fix it like this: 



I think it expects a GMT time instead of local.. 

2018-05-16 11-16-36
João Heleno
 
MVP

Hi Roman

From the API message returned you're getting the error because "Scheduled Notifications may not be scheduled in the past". Could it be the "send_after" parameter?

2020-03-10 21-01-27
Roman

It could be, I'm wondering what would be the right value for it. 

2018-05-16 11-16-36
João Heleno
 
MVP

A date in the future? ;)

2020-03-10 21-01-27
Roman

I'm using CurrentDateTime(). It should work. Probably there's something wrong with the timezones

2018-05-16 11-16-36
João Heleno
 
MVP

Add a minute or two to the current date... with CurrentDateTime() it will be late already when reaching the server :D

2020-03-10 21-01-27
Roman
Solution

Nope. I was able to fix it like this: 



I think it expects a GMT time instead of local.. 

2018-05-10 22-41-57
Carlos Filipe Simões
Staff

Hello, Roman,

Judging from the APIs documentation, they do indeed expect a future date.

But it is possible that timezones interfere with the outcome (judging from your JSON request on the error, not sure if it will be interpreted as UTC, since the date's not on Zulu notation).

Can you share which date time string was sent to the server following your change?

Best regards,

Carlos Simões

2020-03-10 21-01-27
Roman

Before TimeConvert function:
"send_after": "2018-12-19 05:30:16", and response header was Date: Wed, 19 Dec 2018 10:30:17 GMT

I figured they expect GMT time, so now it is: 

"send_after": "2018-12-19 11:06:34",

Response: Date: Wed, 19 Dec 2018 11:06:34 GMT


I might want to add a couple seconds though as suggested previously. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.