Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module provides web push notifications for Drupal sites, specifically integrating with the DANSE and Push frameworks for Progressive Web Apps. It allows users to subscribe to notifications for events like new comments and receive these alerts directly in their browser.

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
8 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

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