1946
Views
5
Comments
[OneSignal Notification Plugin] How to send notification from server?
Question
onesignal-plugin
Mobile icon
Forge asset by Alexandre Costa

Hi,

To send notification from my app I should use PostNotification REST API Method? The documentations is here https://documentation.onesignal.com/reference

Asking just because on plugin demo this method is not used.


Thank you.

2025-10-21 13-42-45
Alexandre Costa

Hi yes, you need to use REST API, I will update OneSignal Api and OneSignal Demo tomorrow with some samples to help.

2017-02-21 16-57-59
Ricardo Silva

have you figured out how to send notifications at all? the only way I found was to copy the method from the OneSignalApi module and use it. Even then, I'm not even sure how I should use it, because of the input parameters

2021-05-05 13-05-18
Mykola (Nick) Tkachenko

Hi Ricardo,

Yes coping the rest method is working fine. You can find information on one signal documentation:

https://documentation.onesignal.com/reference

for example request I use is:

{  "app_id": "xxxxxxxx",  "included_segments": [],  "include_player_ids": ["xxxxxxxxx"],  "url": "https://xxxxxx",  "data": {"parameter1": "value1", "parameter2" : "value2"},  "contents": {"en": "English message."},   "send_after":"2017-01-26T13:38:00"}

2017-02-21 16-57-59
Ricardo Silva

Mykola Tkachenko wrote:

Hi Ricardo,

Yes coping the rest method is working fine. You can find information on one signal documentation:

https://documentation.onesignal.com/reference

for example request I use is:

{  "app_id": "xxxxxxxx",  "included_segments": [],  "include_player_ids": ["xxxxxxxxx"],  "url": "https://xxxxxx",  "data": {"parameter1": "value1", "parameter2" : "value2"},  "contents": {"en": "English message."},   "send_after":"2017-01-26T13:38:00"}

ok, thank you. I also managed to make it work (:

I just found it weird you have to copy paste something, since usually you can just import everything you need from another module.

2012-08-04 21-41-02
Alexandre Costa

Ricardo Silva wrote:

Mykola Tkachenko wrote:

Hi Ricardo,

Yes coping the rest method is working fine. You can find information on one signal documentation:

https://documentation.onesignal.com/reference

for example request I use is:

{  "app_id": "xxxxxxxx",  "included_segments": [],  "include_player_ids": ["xxxxxxxxx"],  "url": "https://xxxxxx",  "data": {"parameter1": "value1", "parameter2" : "value2"},  "contents": {"en": "English message."},   "send_after":"2017-01-26T13:38:00"}

ok, thank you. I also managed to make it work (:

I just found it weird you have to copy paste something, since usually you can just import everything you need from another module.

The problem with the OneSignal API is the possibilities, there are many. I am putting together a more complete example with several of them, basic and some more complex, but they will always be suggestions that can be adapted.


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