Send Push Notifications with OneSignal on Web API

Hi Everyone,

Today I’m representing you a easy way to use OneSignal API with Asp.NET MVC project to send push notifications any platform with OneSignal.

Firsly you can download from here the class library which created for OneSignal by me. Then add the library to your project, or build it and implement dll to your project ((!!! Do not forget to set your parameters in Configuration.cs before building a DLL !!!))


Firstly go Configuration.cs and set your App ID and Rest API KEY paremeters.If you don’t know these parameters, go and sign in on OneSignal and go SETTINGS from menu and click KEYS & IDs tab. You can find these from here.

You can find Visual Studio Project Template here

OneSignal Web API configuration, keys ids



Go your API Controller or what you use to trigger. Just get an instance of Notification class and set your parameters. Some parameters is platform specific and I already added descriptions for theese ones. Set your parameters and don’t forget to set PlayerID, then use Send() method to send this notification. Cool!

Notification myNotification = new Notification();
myNotification.contents = "HEELO FROM PUSH NOTIFICATION!";
myNotification.small_icon = "icon.png";
myNotification.include_player_ids = new List { "OneSignal_playerid_fordevice","Another_onesignal_playerid" };

You can download Class Library:

OneSignal PushNotification Library

Possible Mistakes

  • Install v.10.0.3 or newer version of Newtonsoft.Json to your main project.
  • Do not forget set your App ID and RestAPI KEY in Configuration.cs
label, , , ,


  1. heathercondryspnh 10 March 2018 Reply
    • enisnAuthor 19 March 2018
  2. emre 15 October 2018 Reply
  3. Nick 3 February 2019 Reply
  4. Rimuru 4 April 2019 Reply
  5. Sampath raj 25 November 2020 Reply

Add a Comment

Your email address will not be published. Required fields are marked *