Use Cases
There are three main use cases for the message stack:
- Logging and displaying system events
- Notifying users when messages are generated
- Notifying users who subscribe to certain content
Logging and Displaying System Events
The basic use case for the message stack is a tool for logging and displaying system events. The events may be user initiated (e.g. a page is created) or system initiated. User-initiated events are sometimes called activity streams. Facebook's News Feed is a an example of an activity stream and Google has launched its own tool for tracking changes to files and folders in Google Drive.
In the message stack each message (entity instance) represents a record of what occurred. Different message types (entity bundles) can be used for different situations. For example one message sub type might be used to record information related to the creation of a web page, another might be used to record information about an e-commerce order etc.
You might think that a custom view on a page or series of pages might serve the same purpose but message entities provide much greater functionality:
- Having a separate message entity provides a means of tracking changes to an entity (a web page, a site user etc.) over time.
- Each message type is fieldable, meaning arbitrary data can be stored with a message.
- Also, message types support view modes, which provide developers with a flexible means of rendering messages in different ways as required.
- The message module supports localization so message types can be created to support multilingual web sites.
- Last, but not least, message types can be created with tokens, so that messages can be dynamically generated based on the context at creation time.
One important note is that the Message module does not provide a way to create messages through the user interface. Developers will need to leverage different Drupal hooks, depending on the requirements of the site design. Fortunately, the module includes an example module that demonstrates some typical message types and the hook required to support them. In addition, the Message UI module provides a basic user interface which may be used to gain valuable insight into the architecture of the message stack.
Notifying users when messages are generated
A second major use case is to notify recipients when messages are generated. This functionality is provided by the Message Notify module which 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 Notify includes an example module that demonstrates the usage of notifier plugins. The module also provides hook support for the Rules module, which may be an option for site builders who are familiar with the Rules module or who do not want to use Message Notify methods directly in their code.
Notifying users who subscribe to certain content
The third major use case is where users who subscribe to content will be notified when events occur that involve that content. This use case is implemented through the Message Subscribe module, which in turn leverages the Flag module, which provides subscribe functionality to users.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion


