Moodle notifications on your phone with ntfy

Moodle sends notifications by email, in the bell menu and in the Moodle app. Our free message_ntfy pushes them to any phone through ntfy, on the public server or your own.

Drawing of a phone lying flat with a blue screen and a small blue bell ringing above it.

Short answer: Moodle can send its notifications (a graded essay, a new forum post, a due date) by email, to the bell menu, and to the official Moodle app. Our free plugin, message_ntfy, adds one more way: ntfy, a free, open source push notification service. Users get Moodle notifications on their phone or computer without the Moodle app, and a school can run the ntfy server itself.

This is the thirteenth plugin in our series: one plugin for each Moodle plugin type, each one teaching DevLMS Studio, our AI plugin builder, how that type works. We checked the Moodle plugins directory first: it lists 13 message output plugins, including Slack, Telegram and Pushover, and none for ntfy.

Setting it up

  1. Site administration > Messaging > Notification settings: turn on ntfy, then pick which notifications it may send.
  2. Site administration > Messaging > ntfy (the page appears once ntfy is on): keep https://ntfy.sh or enter your own server. A server that requires sign-in to publish takes an access token.
  3. Each user installs the ntfy app or opens its web app, subscribes to a topic, and enters the same topic under Preferences > Notification preferences > ntfy.

Tapping a notification opens the page in Moodle. On ntfy.sh anyone who knows a topic can read it, so the form suggests a random one. For private notifications, run your own ntfy server with access control. It supports Moodle 4.5 LTS to 5.3. The code is on GitHub.

How a message output works

From Moodle 5.3’s own SMS and email outputs:

  1. A message output is one class with four jobs: send a message, and draw, load and save the user’s own settings for it. Moodle decides who gets what; the output only delivers.
  2. Core does not register a new output by itself. The plugin’s install step adds it to the list and keeps it switched off until an administrator turns it on.
  3. A message counts as sent only when the service confirms it. ntfy answers with a message id, so a login page or an error that comes back as “200 OK” is still a failure.
  4. Text over ntfy’s 4,096 byte limit is cut without breaking a character, and topics are checked against ntfy’s rule (letters, numbers, - and _, up to 64) before they are saved.
  5. The plugin’s settings page is hidden from the admin menu while the output is off. That is why the setup steps above go in that order.

We tested it with PHPUnit against a fake ntfy server, including a notification sent through Moodle’s own messaging code from start to finish, and with browser tests in which a user saves a topic and an administrator sets their own server.

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