Mattermost channels for Moodle courses

Our free communication_mattermost gives each Moodle course a private Mattermost channel whose members follow enrolments. Moodle 4.5 LTS to 5.3.

Drawing of a noticeboard with rows of cobalt speech bubbles pinned to it, next to an open door that people are walking through.

Short answer: Moodle can give a course a chat room through communication providers, but it ships only two, Matrix and a plain custom link. Our free plugin, communication_mattermost, adds Mattermost: each course gets a private channel, enrolled people who have a Mattermost account join it, and people who leave the course leave the channel. It supports Moodle 4.5 LTS to 5.3.

This is the thirty-fifth plugin in our series: one plugin for each Moodle plugin type, each one teaching DevLMS Studio, our AI plugin builder, how that type works. Moodle added communication providers in 4.3 (Communication). When we looked, the plugins directory had no provider beyond core’s, and GitHub had none for Mattermost. Schools that run Mattermost had notification relays only, such as Brightscout’s Mattermost plugin, and Rocket.Chat users built separate activity and local plugins. The demand is indirect: we found no forum thread asking for this exact plugin.

What it does

  • A private channel per course, in a team the admin chooses, with an optional channel purpose set by the teacher.
  • Members follow enrolments. People are matched to Mattermost accounts by email, added to the team, then to the channel. Suspended users are left out.
  • Nobody gets a new account. People without a Mattermost account wait, and an hourly task adds them once they have one. Moodle’s own sync runs only once a week.
  • Leaving works after an email change, because the Mattermost account found for each person is remembered.
  • Deleting a course archives its channel. Messages stay in Mattermost.
  • A connection check page tells the admin the first thing to fix: provider feature off, server not answering, request blocked by Moodle’s HTTP security, token refused, token not an admin, team not found.

What it does not do

Teachers and students are all plain channel members; make teachers channel admins in Mattermost if you need that. It does not create accounts or sign people in. Email is trusted as the match, so keep email change confirmation on in Moodle. Group rooms use the same code but have no test of their own. Moodle still marks communication providers as experimental, so the admin has to turn them on first.

The code is on GitHub.

How a Moodle communication provider works

From Moodle 5.3’s communication code (the same in 4.5):

  1. A provider is one class that creates, updates and deletes a room, adds and removes members, and returns the room’s address. Until it returns an address, the course page shows the room as pending.
  2. Moodle runs room creation and membership changes as background tasks, so a slow chat server never holds up a teacher saving a course.
  3. Requests go through Moodle’s own HTTP client, which blocks private addresses and unusual ports by default. That is the most common reason a self-hosted chat server seems not to answer, so the check page says so.
  4. We test against a real Mattermost 12.1 server in CI, not a mock: 17 unit tests and 3 browser tests on Moodle 4.5 and 5.3, covering enrol, unenrol, a person who has no account yet, an email change, rename, archive and restore.

Need a plugin like this for your own Moodle?

Describe it in DevLMS Studio and watch it built and tested in a real Moodle, or ask our team for a fixed price.

Open DevLMS Studio