Creating Notifications In Drupal 7 Using Message Module

| | 1 min read

As part of a project requirement, we needed to notify users whenever an entity got created, updated, rated, or reviewed. Drupal's 'message' module fulfills this requirement.

We can log and display messages and can even customize the notifier plugins. For creating a notification, we need to install the following modules:

  • message
  • message_notify
  • message_subscribe

The dependent modules are:

  • Flag
  • Ctools
  • Entity API

We can add message types in admin/structure/messages. In message types, we can add fields with the type of the field. When the event is triggered, the rule action is processed for the corresponding messages and it will be saved to the queue table. While cron runs, the message notifies the plugin processes the messages and delivers them. The message notify module provides us with email and SMS notifier.

Message

This module is at the core of message stack. This module help us to create message types.

Message Subscribe

This module helps us to register the notified content when an event is triggered. This messages will get stored in the queue table. For preventing looping of messages in the queue system, apply the following patch to the message_subscribe.module .

Message Notify

This module is used for sending or viewing messages via notifier plugin. Message notifier has 2 default plugins- email and sms.

Hope this article helps!