Tuesday, September 27, 2011

Mediawiki email notifications for any changes

I have to admit I love simplicity of MoinMoin wiki but more than anything I think it is really developer oriented.

Mediawiki on the other hand is more oriented to a general audience. It is a great product which for developers and other technical teams (my area of expertise) lacks of an important concept: People should be able to get alerts for any change even if they did not visit the page after a previous change was notified. If you want to do something like that in Mediawiki you need to add the email addresses in a configuration file. However the format will not be just the diff but an email with a link to visit the diff. Not ideal.

The first thing you will try in Mediawiki to get notifications about a page update is to watch that page. Every time you get an email notification you must click on the page other wise you will stop getting new updates. Updates will resume once you have visited the page. The steps to get email notifications are:
  1. Go to My Prefernces | Email. You might have a link asking for you to activate your email. Click it or you will never get an email.
  2. Once you have done it you will receive the first email and after clicking on the link if you come back to "My Peferences | Profile | Email Options" you will see something like "Your e-mail address was authenticated on 12 August 2010 at 00:37."
  3. Go to "My Peferences | Watchlist" to set extra options like automatically getting subscribed to pages you create.
  4. Now you can monitor any page clicking on the "watch" link. In the monitored page the link should change from "watch" to "unwatch"

Your e-mail address was authenticated on 12 August 2010 at 00:37.


While you can subscribe to an RSS feed you might prefer email.

Fortunately there is a way around this using a freely available python application called rss2email.

This will send emails with the typical diff format but using colors to highlight conflicts, what is new and what has been changed/removed. See below an example:


Below are the steps to install and configure such application:
$ sudo apt-get remove rss2email
$ cd
$ tar xvf rss2email-2.70.tar.gz 
$ sudo cp -R rss2email-2.70 /opt/
$ sudo mv config.py.example config.py
$ sudo chown -R nestorurquizaadmin:nestorurquizaadmin /opt/rss2email-2.70/
$ cd /opt/rss2email-2.70/
$ sudo vi config.py 
...
DEFAULT_FROM = "donotreply@nestorurquiza.com"
...
SMTP_SERVER = "mail.nestorurquiza.com:25"
...
$ r2e new developers@nestorurquiza.com
$ r2e add http://wiki.nestorurquiza.com/index.php/Special:RecentChanges?feed=rss
$ r2e run --no-send #remove the flag in case you want to receive emails right away. Keep the flag to receive new changes.
$ crontab -e
# Send wiki changes to developers every 10 minutes
*/10 * * * * cd /opt/rss2email-2.70;./r2e run
I have found that the ~/.rss2email/feeds.dat can get corrupt in which case you will get errors like:
Traceback (most recent call last): File "rss2email.py", line 940, in elif action == "reset": reset() File "rss2email.py", line 874, in reset feeds, feedfileObject = load() File "rss2email.py", line 487, in load feeds = pickle.load(feedfileObject) EOFError
Following all steps above will reinstall rss2email again of course but you will need to provide all configurations you have added. Hence so important you keep track of them. Remember The palest ink is better than the best memory.

6 comments:

Tomasz Dziurko said...

Hello.

I've encountered your post and found it very valuable but I have one question:
how do you overcame problem that your wiki has restricted access? Because rss2mail does not work with password restricted feeds and as I understood your developers wiki wasn't publicly available?

I am asking because we are struggling with establishing efective way to notify members of our company that something was changed on our media wiki page.

Many thanks in advance for your response.

Nestor Urquiza said...

Hi Tomasz,

The wiki is read only for any anonymous user and password protected for write access.

We can do that because it is accessible only from an intranet which obviously is protected from the wild.

Best,
-Nestor

Tomasz Dziurko said...

Thank you for you answer. The problem with our wiki is that our company is dispersed and there is no intranet to limit access but we still would like to have rss2email notifications working.
I think I need to consider writing custom application/module as probably no one faced similar problem before :)

Nestor Urquiza said...

Most of the companies have people accessing resources from outside the company premises so they can be considered "disperse". You just need to set up a secure remote access.

You need to setup a VPN or a virtual desktop access to your infrastructure. If your wiki is not to be read by the public you should never expose it to the wild.

If you must protect from read access even from some internal resources then you probably would like to use an internal setting from mediawiki http://www.mediawiki.org/wiki/Manual:$wgUsersNotifiedOnAllChanges

Nestor Urquiza said...

Link for array of users to get notifications

Unknown said...

nice post.. i am MediaWiki fresher.. i fetched some useful information here.. thanks.. :) MediaWiki Tutorial For Beginners

Followers