Messaging & Notifications modules for Drupal

Date: Thu May 07 2009 Drupal
One key part of a community web site is a way to notify your users of activity on the site. It helps to bring them back if they receive a notification. Otherwise they might forget about the site. Out of the box Drupal doesn't offer notification capabilities but there are addon modules which do this. I've been using the subscriptions module on my main site however it hasn't been all that pleasant. For example the default notification format exposes users to HTML tags, obviously the email is meant to be rich HTML but when it arrives it's plain text with tags. Also the default notification format is continually confusing my users into thinking they can reply to the email and their reply will go to the user. Unfortunately it doesn't and it's a little frustrating.

The Messaging Framework allows message sending in a channel independent way. It's a very generic service that lets the site send messages, and deliver those messages through multiple delivery formats and protocols. Delivery can be to a Twitter account, an XMPP account, SMS, several forms of email, and the privatemsg module.

The Notifications module is an engine that permits notification to users of events on the site. Again it's pretty generic in scope and there are plugins for specific types of notifications. It uses the Messaging Framework for delivering the notification messages meaning notifications are not limited to email.

I see that I must try Mail to Web because it is a gateway module for responding to posts via email. It links outgoing notifications emails with incoming email responses using a combination of mail parameters and digital signatures.

In any case the Messaging and Notifications set up are a little involved and I want to go over the process.

Both Messaging and Notifications provide multiple modules and for each there are several additional modules providing extra capabilities.

The Messaging modules only provide messaging capabilities. There were no discernible extra features available to users with the Messaging modules installed. Out of the box the following messaging methods are installed:

  • Messaging Mime Mail: Mail Sending Method: Integration with Mime Mail module
  • Messaging PHPMailer: Mail Sending Method: Integration with PHPMailer for HMTL Mail
  • Messaging Privatemsg: Sending Method: Integration with Privatemsg
  • Simple Mail: Mail Sending Method: Integration with Drupal mail API
  • Simple messaging: Sending Method: Show messages on user's page
  • SMS Messaging: Sending Method: SMS
  • Twitter Messaging: Sending method for messaging that uses Twitter

Yes there are three different methods for sending email. I suggest configuring the one (?two?) you wish to support.

The SMS messaging supports sending text messages to cell phones. I can't imagine that being used and would think this would cost someone some money. But, hey, it's an interesting idea. And it's rather interesting to have this modern Twitter thing available. There are two modes of twitter messages, direct twitter messages, and public twitter messages.

To get features discernible to users you must install some of the Notifications modules. These are the most likely modules to install:

  • Content Notifications: Allows users to subscribe to content related events.
  • Notifications UI: Provides an UI to notifications
  • Taxonomy Notifications: Allows users to subscribe to taxonomy terms.

It lets users subscribe to specific nodes on the site, or to specific content types, or to specific taxonomy terms.

Simply enable the modules you think you want.

Now let's look at configuration...

The Messaging and Notifications administration is in one subsection of the administration area.

admin/messaging/settings - Is for the Messaging modules. It sets up the capabilities of each messaging protocol. If you install Twitter Messaging you must set up a Twitter account for the site. This site twitter account will be used for sending out messages from the site.

You're able to select among the messaging protocols which ones your users are allowed to select. And for each messaging protocol you can select the default messaging format and sending interval.

The allowed sending intervals are: immediate, hourly, daily, ...

admin/messaging/notifications - Is for the Notifications modules. This sets up the kind of notification events to which the user can subscribe. For example they can be allowed to subscribe to creating nodes, updating nodes, or making comments. They can be allowed to subscribe to specific content types e.g. they may want to know about new events being posted and nothing else.

The Messaging Templates section is pretty important for configuring the text of the notification. In particular the default notification going to twitter accounts is very wordy, and Twitter values tersness. Configuring the templates is a little obtuse and I'm not certain I understand it.

The idea is there are several sorts of notification events to which users can subscribe, and there is a box per event per messaging protocol that gives the format of the message sent through that protocol about that event. On the Templates area are collapsible sections listing the template for each protocol. In each one is a 'Default' template that's used if no other template is specified, and there is an option to specify a template for the given protocol.

By default no templates are given for twitter protocol hence notifications sent through twitter use the default template. To make twitter notifications terse while leaving other templates more wordy, simply add terse templates in the twitter boxes and leave the other boxes alone. For example one of the default templates is

Greetings [user],
 for which I chose 
 as the twitter template.

It's worth noting that the twitter messaging module does not send messages to the twitter-work-alike-sites such as the software.

Once you have this set up correctly the users 'My Account' page will show a 'Notifications' tab that lets them configure the notifications they wish to receive.

Also if you enable the Twitter modules, when they edit their account a Twitter tab shows up in which they can add twitter accounts. Their twitter accounts then show up in a Twitter tab in their account page.