Progressive Web App - Notifications with firebase
This module for drupal 10, 11
You should install with composer it will add google/auth to vendor.
1. Enable module.
2. Create your project (https://console.firebase.google.com/).
3. Get your access crentials from Settings => Cloud Messaging tab (https://console.firebase.google.com/u/0/project/YOUR-PROJECT-ID/settings...) to Firebase Settings(/admin/config/system/pwa_firebase)
Form version 2.0.9+ module change from legacy FCM APIs to HTTP v1. So you have to configure in module settings to refill all variables. (Attach credentials - Service account key json file is required)
To compose message You can go to firebase /admin/content/notification
It uses asynchronous guzzle promises which will help in sending bulk notifications.
If you want to send a huge user, you can create a view and use VBO. In the configuration you can add an action to "send a notification".
you can show block notification permission to display the message
This module does not use curl to send a message to firebase. So you can use on shared hosting
For Developper:
You can use service to send notification.
- Send notification to all users
\Drupal::service('pwa_firebase.send')->sendMessageToAllUsers($title, $message, $url); - Send a notification to 1 user (with all their devices)
\Drupal::service('pwa_firebase.send')->sendMessageToUser($uid, $title, $message, $url);
Do you like this module? Show your appreciation by buying me ☕.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.