Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Messaging custom components

From MoodleDocs

Intro

Since Moodle 2.0 it has been possible for custom components to send messages and to process a user's received messages via the Moodle messaging system. There are two types of components you may wish to implement.

  • message providers - These create new messages and send them via the message API.
  • message processors - These are optionally enabled by users receiving messages to process messages sent to that user.

Instructions on how to build a message provider and message processor as well as sample code are below.

Message provider

Any component may be a messages provider and send messages through the Moodle messaging API. Full details are provided at Message_API

Message processor

It is possible to create custom components called message processors or message consumer that are notified when a user receives a message. The component can then notify the user via a communication means outside of Moodle or perform some other automated action. Full details of how to create a custom message processor are available at Messaging_consumers