130
Views
7
Comments
Solved
[OneSignal Plugin Sample] Receiving 400 Bad Request
Question
onesignal-plugin-sample
Mobile icon
Forge asset by Daniel Martins

Hi,


I did try to run the application but it is giving me 400 bad request. Please help me solve it.


I am using OutSystems11. I have installed the application on an android device. The application is not running through OutSystems now app. It is really necessary for me do help me.


Regards,

Manthan Shah.

2025-11-05 14-18-02
Segonto Sebetwa
Solution

Nuno Miguel Verdasca wrote:

You can try to solve the problem by following these steps:

  1. Change the Initial_Date and DateFormate parameters of Input_Caledar to the following values:
    1. InitialDate: SyntaxEditor Code Snippet
      AddHours(CurrDateTime(),-3)
    2. DateFormat: SyntaxEditor Code Snippet
      "%Y/%m/%d %H:%M:%S"
  2. In the SendPushNotificationToAll function, which I decided to use, I set the value of the SendAfter parameter as follows:
    1. SendAfter: SyntaxEditor Code Snippet
      AddHours(NotificacaoForm.Record.Notificacao.Data,3)

This solved the "400 Bad Request" problem and I was able to set the scheduling date and time correctly in the OneSignal API.

Cheers,
Nuno Verdasca


Thank you so much for the reply, I found out that my problem was caused by MABS version that the app was configured to and after configuring it to a lower version 3.3 it worked perfectly.

2018-09-27 18-20-33
Swatantra Kumar
Champion

Hi Manthan,

Which version of android?

2019-04-26 10-27-34
Manthan Shah

Swatantra Kumar wrote:

Hi Manthan,

Which version of android?

Hi any solution?

2025-11-05 14-18-02
Segonto Sebetwa

Manthan Shah wrote:

Swatantra Kumar wrote:

Hi Manthan,

Which version of android?

Hi any solution?

Hi

I am experiencing the same issue, did you find a solution



2019-04-26 10-27-34
Manthan Shah

Hi,


I am using android version 7.0.

Regards,

Manthan Shah.

2025-11-19 06-14-01
Miguel Verdasca
Champion

Hello, the official new OneSignal component from OutSystems has a bug in populating the send_after property internally the component checks if this property is not sent and if it does not populate with CurrDateTime () this will work when the server is set to the American date standard. Just open the OneSignalAPI project in the ServerActions / PushNotifications / PostNotification folder and change the Assign in Has Deeplink's false option to

SyntaxEditor Code Snippet

If(DateTimeToDate(SendAfter) = NullDate(), "", SendAfter)

rather than

If(DateTimeToDate(SendAfter) = NullDate(), CurrDateTime(), SendAfter)


this will solve your bad request, unfortunately even filling in the property will continue with error because the property is like datetime not giving you the freedom to set it the correct in this case would the property be text to each format appropriately according to your situation or a better intelligence within the component to do this taking the format OneSignal hopes to achieve.

In addition to the above steps it is necessary to remove the Default value that is like CurrDateTime () from the SendAfter input variables of the PostNotification and SendPushNotificationToUserId methods otherwise even if empty the component will insist on sending the date and time in the wrong format.

Hope this helps.

Cheers,
Nuno Verdasca

2025-11-19 06-14-01
Miguel Verdasca
Champion

You can try to solve the problem by following these steps:

  1. Change the Initial_Date and DateFormate parameters of Input_Caledar to the following values:
    1. InitialDate: SyntaxEditor Code Snippet
      AddHours(CurrDateTime(),-3)
    2. DateFormat: SyntaxEditor Code Snippet
      "%Y/%m/%d %H:%M:%S"
  2. In the SendPushNotificationToAll function, which I decided to use, I set the value of the SendAfter parameter as follows:
    1. SendAfter: SyntaxEditor Code Snippet
      AddHours(NotificacaoForm.Record.Notificacao.Data,3)

This solved the "400 Bad Request" problem and I was able to set the scheduling date and time correctly in the OneSignal API.

Cheers,
Nuno Verdasca

2025-11-05 14-18-02
Segonto Sebetwa
Solution

Nuno Miguel Verdasca wrote:

You can try to solve the problem by following these steps:

  1. Change the Initial_Date and DateFormate parameters of Input_Caledar to the following values:
    1. InitialDate: SyntaxEditor Code Snippet
      AddHours(CurrDateTime(),-3)
    2. DateFormat: SyntaxEditor Code Snippet
      "%Y/%m/%d %H:%M:%S"
  2. In the SendPushNotificationToAll function, which I decided to use, I set the value of the SendAfter parameter as follows:
    1. SendAfter: SyntaxEditor Code Snippet
      AddHours(NotificacaoForm.Record.Notificacao.Data,3)

This solved the "400 Bad Request" problem and I was able to set the scheduling date and time correctly in the OneSignal API.

Cheers,
Nuno Verdasca


Thank you so much for the reply, I found out that my problem was caused by MABS version that the app was configured to and after configuring it to a lower version 3.3 it worked perfectly.

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