2026-05-31 03:17:16 +09:00
2026-05-31 02:18:42 +09:00
2026-05-31 03:17:16 +09:00
2018-12-16 21:12:13 +00:00
2026-05-31 03:17:16 +09:00
2026-05-31 02:18:42 +09:00

Matrix (mw-matrix)

MediaWiki extension for sending notifications to a Matrix webhook from MediaWiki. When a certain event occurs on your MediaWiki wiki, including new edits, they can be sent as a message to a channel on a Matrix server using a webhook.

Multiple webhook URLs are supported and messages will be sent to all of them.

Live demo: https://runescape.wiki (https://matrix.gg/runescapewiki)

Example

Requirements

  • Matrix webhook URL: Found by editing a channel -> Integrations -> Webhooks
  • MediaWiki: This extension aims to always support the latest LTS release.
    • Use the branch that is equal to, or below your current version.
    • We do not support versions of MediaWiki that are considered end-of-life.
    • The master branch may contain changes that are only applicable to the current alpha version of MediaWiki.
  • cURL (likely installed already). Without this, the extension may still work, but requests will be sent inefficiently.

Installation

  1. Clone this repository to your MediaWiki installation's extensions folder using git clone https://github.com/jaydenkieran/mw-matrix.git -b REL1_35 Matrix
  2. Modify your LocalSettings.php file and add:
// Load the extension
wfLoadExtension( 'Matrix' );
// Set the webhook URL(s) (string or array)
$wgMatrixWebhookURL = [ '' ];

For further configuration variables, see below.

Getting a webhook URL

To get a webhook URL for use with this extension, open the Matrix client and go to a server where you have the Manage Webhooks permission. Click the cog icon when hovering over a text channel, switch to the Webhooks tab on the left of the interface, and click 'Create webhook'. The webhook URL can then be copied from that interface.

Configuration

This extension can be configured using the LocalSettings.php file in your MediaWiki installation.

Variable Type Description
$wgMatrixWebhookURL string/array Matrix webhook URLs

Optional

These parameters aren't required for the extension to work.

Variable Type Description Default
$wgMatrixNoBots bool Do not send notifications that are triggered by a bot account true
$wgMatrixNoMinor bool Do not send notifications that are for minor edits false
$wgMatrixNoNull bool Do not send notifications for null edits true
$wgMatrixSuppressPreviews bool Force previews for links in Matrix messages to be suppressed true
$wgMatrixMaxChars int Maximum amount of characters for user-generated text (e.g summaries, reasons). Set to null to disable truncation null
$wgMatrixMaxCharsUsernames int Maximum amount of characters for usernames. Set to null to disable truncation 25
$wgMatrixDisabledHooks string array List of hooks to disable sending webhooks for (see below) []
$wgMatrixDisabledNS int array List of namespace IDs to disable sending webhooks for. (see below) []
$wgMatrixDisabledUsers string array List of users whose performed actions shouldn't send webhooks []
$wgMatrixPrependTimestamp bool Prepend a timestamp (in UTC) to all sent messages. The format can be changed by editing the MediaWiki message matrix-timestampformat false
$wgMatrixUseEmojis bool Prepend emojis to different types of messages to help distinguish them false
$wgMatrixEmojis string associative array Map of hook names and their associated emojis to prepend to messages if $wgMatrixUseEmojis is enabled See extension.json

Hooks used

  • PageSaveComplete - New edits to pages and page creations
  • PageDeleteComplete - Page deletions
  • PageUndeleteComplete - Page restorations
  • ArticleRevisionVisibilitySet - Revision visibility changes
  • ArticleProtectComplete - Page protections
  • PageMoveComplete - Page moves
  • LocalUserCreated - User registrations
  • BlockIpComplete - User blocked
  • UnblockUserComplete - User unblocked
  • UserGroupsChanged - User rights changed
  • UploadComplete - File was uploaded
  • FileDeleteComplete - File revision was deleted
  • FileUndeleteComplete - File revision was restored
  • AfterImportPage - Page was imported
  • ArticleMergeComplete - Article histories were merged
  • RenameUserComplete - Rename was completed

Approved Revs

  • ApprovedRevsRevisionApproved - Revision was approved
  • ApprovedRevsRevisionUnapproved - Revision was unapproved
  • ApprovedRevsFileRevisionApproved - File revision was approved
  • ApprovedRevsFileRevisionUnapproved - File revision was unapproved

Namespaces

As we use namespace IDs the following resources might be helpful:

Translation

You can submit translations for this extension on Translatewiki.net.

License

This extension is available under the MIT license. You can see here for more information.

This extension was inspired by Szmyk's mediawiki-matrix project.

S
Description
MediaWiki extension that sends notifications to Matrix
Readme MIT 462 KiB
Languages
PHP 100%