In this tutorial, you will learn, how to send Push Notification using the Python programming(Automated).

The above link explains
1. How to create a basic Ionic 2 project
2. How to install the necessary push plugins
3. How to get the Firebase Cloud Messaging Server API Key
4. How to get the Device registration id.
5. How to generate APK

You have to create a simple working push notification Ionic 2 application using the above link. 

When you open the application on your device, it will generate a device registration id for push notification, which can be stored in the database. However, the above example had PHP code to catch and save the device registration id. So you have to write your PHP server code to catch data or you can use python web frameworks to catch data.

To execute the Firebase Cloud Messaging URL in Python, you need the requests package.

Install the requests package using the below command in terminal.

pip install requests

Python Code for Push Notification

import requests
import json



url = ''

msg={'message':'here is a message. message',
'title':'This is a title. title',
'subtitle':'This is a subtitle. subtitle',
'tickerText':'Ticker text here...Ticker text here...Ticker text here',
fields = {
'registration_ids': registrationIds,
'data': msg

# Adding empty header as parameters are being sent in payload
headers = {'Authorization':'key='+API_ACCESS_KEY,
'Content-Type': 'application/json'}
r =, data=json.dumps(fields), headers=headers)

Replace the YOUR_API_ACCESS_KEY with your Firebase Cloud Messaging API key. And also replace the DEVICE_REGISTRATION_ID with the actually generated device registration id. Then save the above code as and run the above code using


That's all.