https://github.com/kulikov-dev/firebase-push
Small scripts for working with Firebase Cloud Messaging (FCM) web push notifications
https://github.com/kulikov-dev/firebase-push
fcm-push-notification firebase github-pages javascript php web-notifications
Last synced: about 1 year ago
JSON representation
Small scripts for working with Firebase Cloud Messaging (FCM) web push notifications
- Host: GitHub
- URL: https://github.com/kulikov-dev/firebase-push
- Owner: kulikov-dev
- License: mit
- Created: 2022-10-13T05:55:06.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-17T18:05:24.000Z (over 3 years ago)
- Last Synced: 2025-04-01T14:22:05.172Z (about 1 year ago)
- Topics: fcm-push-notification, firebase, github-pages, javascript, php, web-notifications
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Test Firebase Cloud Messaging
-----------------------------
Small scripts for working with Firebase Cloud Messaging (FCM) web push notifications. Based on [quickstart-js](https://github.com/firebase/quickstart-js)
* Clean scripts without excess code. Ready to use;
* Added opportunity to work and test on [github pages](https://kulikov-dev.github.io/firebase-push/);
* Added possibility to process click on a notification: open or focus a linked page.
There are four scripts here:
* firebase_client.js - which used on a client side for subscription for notifications;
* firebase-messaging-sw.js - is the ServiceWorker;
* firebase_webhook.php - which process users token on a server side and save it to storage for future usage;
* firebase_notifications_sender.php - sample script for sending notifications.
The best way to test client side is use Postman with sending POST messages with:
* This auth info: Authorization - Key=your-server-key
* To this address: https://fcm.googleapis.com/fcm/send
* With this data (you can send up to 500 user tokens in one message):
```json
{
"data": {
"title": "Title",
"body": "Notification message",
"icon": "https://kulikov-dev.github.io/firebase-push/notification_logo.jpg",
"click_action": "https://kulikov-dev.github.io/firebase-push/"
},
"to": "user-token-id"
}
```
* To get 'Server key' you need to enable 'Cloud Messaging API (Legacy)'.