Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send one signal notification from asp.net webapi to ionic app

I'm developing android and iOS application using cordova ionic and I include one signal notification as a feature in my app.

I register onesignal and test to push notification. It's work well.

Now I want to send onesignal notification from asp.net web api to perticular user. I have tried this url but I failed. Also i am unable to get device token in my app.

Thank you.

like image 677
vickstricks Avatar asked Sep 12 '16 07:09

vickstricks


People also ask

How do I send a notification from OneSignal?

To get the API Key and the App ID from OneSignal, navigate to the OneSignal Dashboard and click on the app you created inside of OneSignal. Once you have selected the app you want to work with, click the Settings tab. On this page, click on Keys & IDs. Copy the OneSignal App ID and the REST API Key.

Does ionic support push notification?

Ionic is easy to integrate with Firebase and Firebase Cloud Messaging, which allows you to enable push notifications quickly.


1 Answers

You need to call window.plugins.OneSignal.getIds and store ids.userId from the callback.

You can then make a POST call to the https://onesignal.com/api/v1/notifications endpoint from your ASP.NET code setting the include_player_ids to the userId retrieved from your app.

There is an ASP.NET example towards the bottom of the endpoint documentation page listed below. https://documentation.onesignal.com/reference#create-notification

like image 130
jkasten Avatar answered Sep 27 '22 19:09

jkasten