Send Push Notification From App using OneSignal API without Extension

This is simple guide to teach you about sending push notifications from app using OneSignal API without using any extention.

Requirements:

  1. Web server (Any free webserver like https://www.000webhost.com)
  2. File editor or IDE.
  3. Basic programming knowledge (PHP)
  4. Kodular account :kodular:

Download this PHP files

Download both classes.php and sendpush.php and store it in your computer.

Step 1: Open sendpush.php in any file editor and enter your OneSignal APP_ID and API_KEY and save the file.

Step 2: Upload both classes.php and sendpush.php into your 000webhost FileManager make sure your uploaded both file in same directory.
For example:
/public_html/classes.php
/public_html/sendpush.php

Now we are done with server side. Next we need to create a kodular project to send push notification from the app. Look at the App User Interface and Blocks

Procedure Documentation
1 . heading (required) (text) - Title of your notification
2 . Content (required) (text) - content of notification
3 . url (optional) (text) - URL will be opened when notification opened. If not specified app will be opened.
4 . largeIcon (optional) (text) - An icon will be visible on right of the notification (see output). Pass direct image URL or type “ya” to show your app icon.
5 . bigpicture (optional) (text) - A big banner image will be appear in notification (see output). Pass direct image URL.

Output:

23 Likes

Thank you for your guide. :+1:

2 Likes

Great and simple guide thanks for the guide.

1 Like

Nice Guide…
Thanks for your contribution to the community…
:slightly_smiling_face:

1 Like

Notification not received on my device

@themaayur you wrongly defined API ID and API KEY.

@themaayur

//Your OneSingal APP ID
define("APP_ID", "YOUR_APP_ID_HERE");
//Your Onesignal API KEY
define("API_KEY", "YOUR_API_KEY_HERE");

Enter your API ID in the place of YOUR_APP_ID_HERE
Enter your API KEY in the place of YOUR_API_KEY_HERE

1 Like

Ohhh, Got it thanks…I will check it out.

I have done that it’s showing error


But I have entered content in textbox.

@themaayur message should be any English language

As u can see in above screenshot everything is in English language.

@themaayur please check your blocks

Here are the blocks.

@themaayur check your set web1 url block it should be contents not content

Ohh Sorry my mistake, Btw Thanks for support.
But why is it showing white dot in icon. what if i will the default bell icon.

@themaayur if you want to use default bell icon make small_icon value to empty

If i want to fix a small icon so that i do not have to set it every time then what should i do?

1 Like

Look at this topic