Moodle

Interact with Moodle LMS - Complete Integration (v0.1.0)

Overview

This node integrates with the Moodle Learning Management System (LMS) via its web service API. Specifically, the "Get Enrolled Users" operation under the Course resource retrieves a list of users enrolled in a specified course.

This operation is useful for educational administrators or instructors who want to programmatically access enrollment data for courses. For example, it can be used to:

  • Generate reports on course participation.
  • Sync enrolled users with other systems.
  • Trigger workflows based on course membership changes.

Practical example: An institution could use this node to fetch all students enrolled in a particular course and then send them notifications or update their records in an external CRM system.

Properties

Name Meaning
Course ID The unique identifier of the course for which to retrieve enrolled users. This is a required numeric field.

Output

The output is a JSON array where each element represents a user enrolled in the specified course. Each user object contains detailed information as returned by Moodle's core_enrol_get_enrolled_users web service function. Typical fields include user ID, username, full name, email, roles, and other profile details.

No binary data is output by this operation.

Example output snippet (simplified):

[
  {
    "id": 123,
    "username": "student1",
    "fullname": "Student One",
    "email": "student1@example.com",
    "roles": [
      {
        "roleid": 5,
        "name": "Student"
      }
    ],
    ...
  },
  {
    "id": 456,
    "username": "student2",
    "fullname": "Student Two",
    "email": "student2@example.com",
    "roles": [
      {
        "roleid": 5,
        "name": "Student"
      }
    ],
    ...
  }
]

Dependencies

  • Requires a valid Moodle API authentication credential configured in n8n to authorize requests.
  • The Moodle instance must have web services enabled and the authenticated user must have permission to call core_enrol_get_enrolled_users.
  • No additional external dependencies beyond the Moodle API.

Troubleshooting

  • Common issues:

    • Invalid or missing Course ID will cause the request to fail.
    • Insufficient permissions for the API user to access enrollment data.
    • Moodle web services not enabled or misconfigured.
    • Network connectivity issues between n8n and the Moodle server.
  • Error messages:

    • Errors from Moodle API calls are propagated. For example, if the course does not exist or the user lacks permission, the error message from Moodle will be included.
    • If no users are found, the output will be an empty array; this might indicate no enrollments or permission restrictions.
  • Resolution tips:

    • Verify the Course ID is correct and exists in Moodle.
    • Ensure the API user has the necessary capabilities to view enrolled users.
    • Check Moodle web services configuration and enable required functions.
    • Test connectivity and credentials separately using Moodle's API testing tools.

Links and References

Discussion