2

I'm working on a custom module to handle time off requests for an intranet site and I'd like to be able to have the module fire off email notifications to a configurable list of users -- specifically, the requesting user's supervisor and also CC: an HR representative.

I've looked at Notify and Notifications and I assume that one or both of those expose an API but I can't find any documentation about how to integrate that into a custom module. I also looked at Rules, though I'm not sure that's the best solution.

I could always do a completely custom job but I'd hate to reinvent the wheel if there's a better Drupal-style solution like hooking into one of these existing notification modules.

2

Have a look at the Message Stack, these are the basic components and dependencies of it:

enter image description here

Some more details about the Message-related modules (=quotes are from the module's project page):

  • Message:

    The Message module is the core of the message stack. It enables logging and displaying system events in a number of different use cases. Events that are recorded over time are sometimes call activity streams. Exportable messages subtypes can be created for different use cases with custom fields and display (view) modes.

  • Message Notify.

    This module provides a method for sending a message via a notifier plugin. Message Notify comes with plugins for email and SMS and may be extended to other transport mechanisms as required.

  • Message Subscribe.

    With this module, users who subscribe to content will be notified when events occur that involve that content. The module leverages the Flag module, which provides a subscribe functionality to users.

Quite a few popular Drupal distributions already adopted to this Message Stack, Open Atrium is one of them.

If you'd rather look at an existing module as an example, then checkout the 7.x-4.x version of the Answers module (disclosure: I'm a co-maintainer) and its Answers Notification sub-module. This sub-module allows logged in users to subscribe to selected questions, so that they receive notifications (using the Message Stack) when Questions receive Answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.