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

vickstricks picture vickstricks · Sep 12, 2016 · Viewed 8.1k times · Source

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.

Answer

jkasten picture jkasten · Sep 13, 2016

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