Notifications Are Not Sent When They Should Be

Created on 22 July 2025, 12 days ago

Problem/Motivation

Notifications should be sent immediately.

Steps to reproduce

1. Edit content type, configure DANSE create event for 'Create'. Select "Default value for 'Create Push Notification", save.
2. Configure Push Framework
* Subject = [site:name] Notification: [current-date:medium]
* Body = Vista9 Development Site (Click Link): [site:base-url]
save.
* Create article using configured content type.

If you do nothing else, no notification will be sent. Notification will be sent if you:
* Exit browser, restart and return to your site after cron runs (every hour for my site)
* Exit browser, use a shortcut to go directly to the new article (if you want [current-page:url:unaliased] to show the node number of the new article)
* Run drush cron from the command line or from the UI. cron doesn't trigger a notification unless *YOU* run it.

Proposed resolution

In this case, a notification should be sent as soon as the new article is created.

In creating this issue, I noticed configuration can only be done for Push Framework and DANSE. There are more parts to this. If I should be looking elsewhere to get this working with Slack, please let me know.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.3

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sbrown1038
  • 🇩🇪Germany jurgenhaas Gottmadingen

    DANSE and Push Framework are designed to decouple process steps from each other and more important, make sure that the user doesn't have to wait for the browser to refresh only because the backend is about to send hundreds or thousands of notifications.

    Therefore, notifications are queued and processed asynchronously. And you don't have to wait for cron for that to happen, there are drush commands available that run all the necessary tasks as you require that to happen. Some of those drush commands are:

      danse:notifications:create (dnc)                          Create notifications.                                                                                               
      pf:queue:process                                          Push all items in the queue.                                                                                        
      pf:sources:collect                                        Execute all items on all source plugins.     
    
  • Thank you for your reply.

    I'm not talking about "hundreds or thousands" of notifications. I'm talking about a single notification being sent to Slack when an article (node) is created. By not sending the notification immediately, some of the tokens will display the URL for whatever page is active instead of the URL of the new article. If you trigger the notifications with drush cron, the URL will display with node number 1.

    In DANSE settings for a particular content type, there is a line for 'Create Event' with choices Create, Update, Delete, Publish, Unpublish and Comment. It would seem a logical place not only to create a notification but also to send it. Since the E in DANSE is for Event, I'd expect event driven behavior -- not something that I have to find some other way to trigger. Sending notifications to a queue for asynchronous processing could be an option if the application requires it, but if you're using the Push Framework Slack module, you're most likely sending one notification to one channel.

    Previously, there was a single Drupal module for Slack that sent notifications immediately. It doesn't seem to be compatible with Drupal 11. Perhaps someone can cobble together a Slack-specific module from PF/PF Slack/DANSE/ECA/Etc. that works like the old, abandoned module.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Separation of concern is they key here. DANSE listens to events (yes, that where the E comes from) and if any event is relevant, it remembers it.

    In a second step, an async process determines, who needs to be notified. And it creates notification entities as appropriate.

    The final step then is delivery. And the Push Framework which is responsible for that, has pretty complex architecture to deal with multiple channels, and still making sure that every user only gets notified once about the same event. Because otherwise notifications become very annoying.

    The fact that your scenario happens to send only a single notification is something that the system can's know upfront. It's built for potentially large numbers of notifications, that's why this is a separate step.

    If your Drush isn't aware of the real URL of your Drupal site and therefore doesn't include that into links, then Drush configuration is incorrect, or at least incomplete.

    You don't like that architecture? Then you may be better of looking for a different module that better fits your needs.

Production build 0.71.5 2024