Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

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?

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.

Activity

Tracked releases
1
Tracked since
Oct 2025
Latest release
10 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
1.0.1-beta2 Pre-release 10–11 Oct 20, 2025