Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

pf_notifications

12 sites Security covered
View on drupal.org

About

Provides web push notifications for DANSE events. Implements Web Push library for PHP, DANSE and Push framework, tailored and tested - a single case scenario though - to work with PWA.

Many thanks to:

For requirements see composer.json

Install and configure

  1. Get module via composer, this will fetch all requirements.
  2. Enable module drush en pf_notifications

  3. Add this permission to Role(s) who are granted to subscribe to notifications:
    Access POST on Push notification subscription resource
  4. Go to Configuration > System > Push framework > Notifications (/admin/config/system/push_framework/pf_notifications) and generate or enter VAPID keys. Tweak any other settings there.
  5. Try there Test notification too - check "Subscribe" checkbox there before hitting "Send" button.
  6. If not yet - configure DANSE content for Content and Comment types you wish to implement notifications. Check some resources @sebastix.nl and perhaps this issue.

There is an article written by @Sebastix here: https://sebastix.nl/blog/using-web-push-notifications-with-a-drupal-progressive-web-app/ explaining how to configure this module with DANSE and enable push notifications with the PWA module.

Usage scenario: a very basic example

  1. First test on config page, test notification found there.
  2. Login as user1 and post a content that will hold the thread with comments. Then, use DANSE's widget to subscribe for when other users comment there.
  3. In the other browser login as user2 and post a comment on the same content. Subscribe this user for any of available DANSE subscriptions.
  4. Then, either have advanced queue do its thing on cron runs, or if you have Ultimate cron module you can execute at least two jobs on the page /admin/config/system/cron/jobs. Or run DANSE notifications and PF queues with drush

    drush danse:notifications:create
    drush pf:sources:collect
    drush pf:queue:process

Result: user1 shall get the browser's/device's notification where is logged.

Other usage: direct notifications

To use direct notifications, skipping DANSE and Push framework, it's possible with a module's service. In particular with usage of 2 methods \Drupal::service('pf_notifications.subscription')->prepareLibraries($danse_key, 0, $entity) and
\Drupal::service('pf_notifications.subscription')->subscriptionResponse($op, $danse_key, $entity, $response, 0, FALSE).
See README for a full example.

Hooks

See pf_notifications.api.php for a couple of hooks available.

TODO

  • Implement Service worker unregister/update on uninstall. If module is installed again soon user may need to un-subscribe first, to flush existing, now invalid service worker subscription.
  • Push notification shall link to DANSE message, to flag it as seen?

Activity

Total releases
1
First release
Oct 2025
Latest release
5 months ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.1-beta2 Pre-release Oct 20, 2025