metakgp/slack_mediawiki

Name: slack_mediawiki

Owner: metakgp

Description: Slack Mediawiki - Integrate Slack with Mediawiki. Sends notifications into your Slack room when certain actions are being performed in your wiki (for example when article is being edited, new article was added...)

Forked from: kulttuuri/slack_mediawiki

Created: 2017-09-12 17:05:21.0

Updated: 2017-09-12 17:05:22.0

Pushed: 2017-06-17 10:06:28.0

Homepage: https://www.mediawiki.org/wiki/Extension:SlackNotifications

Size: 44

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Slack MediaWiki

This is a extension for MediaWiki that sends notifications of actions in your Wiki like editing, adding or removing a page into Slack channel.

Looking for extension that can send notifications to HipChat or Discord?

Screenshot

Supported MediaWiki operations to send notifications
Requirements
How to install

1) Create a new Slack Incoming Webhook. When setting up the webhook, define channel where you want the notifications to go into. You can setup a new webhook on this page.

2) After setting up the Webhook you will get a Webhook URL. Copy that URL as you will need it in step 4.

3) Download latest release of this extension, uncompress the archive and move folder SlackNotifications into your mediawiki_installation/extensions folder.

4) Add settings listed below in your localSettings.php. Note that it is mandatory to set these settings for this extension to work:

ire_once("$IP/extensions/SlackNotifications/SlackNotifications.php");
equired. Your Slack incoming webhook URL. Read more from here: https://api.slack.com/incoming-webhooks
lackIncomingWebhookUrl = "";
equired. Name the message will appear to be sent from. Change this to whatever you wish it to be.
lackFromName = $wgSitename;
RL into your MediaWiki installation with the trailing /.
ikiUrl      = "http://your_wiki_url/";
iki script name. Leave this to default one if you do not have URL rewriting enabled.
ikiUrlEnding = "index.php?title=";
hat method will be used to send the data to Slack server. By default this is "curl" which only works if you have the curl extension enabled. This can be: "curl" or "file_get_contents". Default: "curl".
lackSendMethod = "curl";

5) Enjoy the notifications in your Slack room!

Additional options

These options can be set after including your plugin in your localSettings.php file.

Customize room where notifications gets sent to

By default when you create incoming webhook at Slack site you'll define which room notifications go into. You can also override this in MediaWiki by setting the parameter below. Remember to also include # before your room name.

lackRoomName = "";
Remove additional links from user and article pages

By default user and article links in the nofication message will get additional links for ex. to block user, view article history etc. You can disable either one of those by setting settings below to false.

f this is true, pages will get additional links in the notification message (edit | delete | history).
lackIncludePageUrls = true;
f this is true, users will get additional links in the notification message (block | groups | talk | contribs).
lackIncludeUserUrls = true;
f this is true, all minor edits made to articles will not be submitted to Slack.
lackIgnoreMinorEdits = false;
Set emoji for notification

By default notification in Slack has the default emoji for notification. You can customize this with the setting below. You can find all available emojis from here.

lackEmoji = "";
Show edit size

By default we show size of the edit. You can hide this information with the setting below.

lackIncludeDiffSize = false;
Disable new user extra information

By default we show full name, email and IP address of newly created user in the notification. You can individually disable each of these using the settings below. This is helpful for example in situation where you do not want to expose this information for users in your Slack channel.

f this is true, newly created user email address is added to notification.
lackShowNewUserEmail = true;
f this is true, newly created user full name is added to notification.
lackShowNewUserFullName = true;
f this is true, newly created user IP address is added to notification.
lackShowNewUserIP = true;
Disable notifications from certain user roles

By default notifications from all users will be sent to your Slack room. If you wish to exclude users in certain group to not send notification of any actions, you can set the group with the setting below.

f this is set, actions by users with this permission won't cause alerts
xcludedPermission = "";
Actions to notify of

MediaWiki actions that will be sent notifications of into Slack. Set desired options to false to disable notifications of those actions.

ew user added into MediaWiki
lackNotificationNewUser = true;
ser or IP blocked in MediaWiki
lackNotificationBlockedUser = true;
rticle added to MediaWiki
lackNotificationAddedArticle = true;
rticle removed from MediaWiki
lackNotificationRemovedArticle = true;
rticle moved under new title in MediaWiki
lackNotificationMovedArticle = true;
rticle edited in MediaWiki
lackNotificationEditedArticle = true;
ile uploaded
lackNotificationFileUpload = true;
rticle protection settings changed
lackNotificationProtectedArticle = true;
Additional MediaWiki URL Settings

Should any of these default MediaWiki system page URLs differ in your installation, change them here.

ikiUrlEndingUserRights          = "Special%3AUserRights&user=";
ikiUrlEndingBlockUser           = "Special:Block/";
ikiUrlEndingUserPage            = "User:";
ikiUrlEndingUserTalkPage        = "User_talk:";
ikiUrlEndingUserContributions   = "Special:Contributions/";
ikiUrlEndingBlockList           = "Special:BlockList";
ikiUrlEndingEditArticle         = "action=edit";
ikiUrlEndingDeleteArticle       = "action=delete";
ikiUrlEndingHistory             = "action=history";
ikiUrlEndingDiff                = "diff=prev&oldid=";
Setting proxy

To add proxy for requests, you can use the normal MediaWiki way of setting proxy, as described here. Basically this means that you just need to set $wgHTTPProxy parameter in your localSettings.php file to point to your proxy.

Contributors

@jacksga @Meneth

License

MIT License

Issues / Ideas / Comments

Feel free to use the Issues section on Github for this project to submit any issues / ideas / comments! :)


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.