I'm sending a default Onesignal
SendPushNotificationToUserId
and I'm getting this error. Any idea how to fix?
Nope. I was able to fix it like this:
I think it expects a GMT time instead of local..
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?
It could be, I'm wondering what would be the right value for it.
A date in the future? ;)
I'm using CurrentDateTime(). It should work. Probably there's something wrong with the timezones
Add a minute or two to the current date... with CurrentDateTime() it will be late already when reaching the server :D
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
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.