I want to send Push Notification from a Python file to Chrome . Also, I want to give an option to open a dashboard via the Push notification.
What can be used here ? Not planning to use 3rd party apps such as OneSignal , as I have to deploy this in Production .
Really looking for some suggestions.
Also I have created a web extension that creates a push notification with the following info :
( Problem : - This message is static . I want it to be dynamically updated .
- Also, I want it the event to be something else apart from click.
So that it shows the information once it's updated )
manifest.json :
{
"name": "Check Dashboard",
"version": "1.0",
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": [
"js/app.js"
]
}
],
"background" : {
"scripts" : ["js/background.js"],
"persistent": false
},
"permissions": ["notifications"],
"browser_action": {
"default_icon": "icon.png"
},
"manifest_version": 2
}
app.js :
console.log('Greet bot!');
const button = document.createElement('button');
button.textContent = 'Check Dashboard!'
document.body.insertAdjacentElement('afterbegin', button);
button.addEventListener('click', () => {
chrome.runtime.sendMessage('', {
type: 'notification',
options: {
title: 'Kafka Alerts',
message: 'Message',
iconUrl: '/icon.png',
type: 'basic'
}
});
});
background.js :
chrome.runtime.onMessage.addListener(data => {
if (data.type === 'notification') {
chrome.notifications.create('', data.options);
}
});