Skip to content
Related Articles

Related Articles

Improve Article

Send Chrome Notification Using Python

  • Last Updated : 29 Jun, 2021
Geek Week

In this article, we are going to see how to send a Chrome notification from your PC to a phone or several devices in this article. We may send messages, links, and other content. For this, we’ll use Python’s notify2 module and its various capabilities, which will help us in delivering messages to many devices.

notify2 is a Python module that is used to deliver notifications and may be used for a variety of applications. For example, if we are creating a news notifier and you want to view the changes on your smartphone rather than your local workstation, we can easily use this module.

Installation:

pip install notify2

Stepwise Implementation:

Step 1: Create a program that takes you to subscribe to the webapps.

Python3




from notify_run import Notify
  
notify = Notify()
notify.register()

Output:



You will be given a link and a QR code; click on the link or scan the QR code to proceed.

Step 2: When you click on the link, you will be presented with the following interface:

Step 3: Simply click on the subscribe on this device button, and if you want alerts on other devices, the link is provided at the bottom; simply go to your device’s chrome, copy this URL, and then click on the subscribe on this device button.

Step 4: Now write a Python program to send the notification.

For sending alerts, the send function is utilized. Simply write a message within the send function and execute the script; you will be alerted by Chrome as well as any devices to which you have subscribed.

Python3






from notify_run import Notify
  
notify = Notify()
notify.send("Any Message you want to send")

Output: 

You will notify by Chrome after you run the script

After you run the script, the message will also be shown on the web:

Other devices, like the phone:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :