Moodle

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

Overview

This node integrates with the Moodle Learning Management System (LMS) to manage users, courses, enrollments, grades, messages, and system information via Moodle's web service API. Specifically, for the User - Create operation, it allows creating a new user in Moodle by providing essential user details such as username, password, name, and email, along with optional additional profile fields.

Common scenarios where this node is beneficial:

  • Automating user account creation during onboarding processes.
  • Bulk importing users from external systems into Moodle.
  • Integrating Moodle user management with other platforms or workflows.

Practical example:

  • When a new employee joins a company, an automated workflow can create their Moodle user account with their credentials and profile information, enabling immediate access to training materials.

Properties

Name Meaning
Username The unique username for the new user.
Password The password for the new user account.
First Name The user's first name.
Last Name The user's last name.
Email The user's email address.
Additional Fields Optional extra user profile fields including: Address, City, Country (e.g., US, GB, FR), Department, Description (bio), ID Number (e.g., student or employee ID), Institution, Mobile Phone, Phone, Timezone (e.g., America/New_York).

Output

The output JSON object represents the newly created user with all returned user data from Moodle. It includes standard user properties plus two additional metadata fields:

  • _created: A boolean flag set to true indicating the user was successfully created.
  • _username: The username of the created user for easy reference.

Example output snippet:

{
  "id": 123,
  "username": "jdoe",
  "firstname": "John",
  "lastname": "Doe",
  "email": "[email protected]",
  "_created": true,
  "_username": "jdoe"
}

No binary data output is produced by this operation.


Dependencies

  • Requires a valid connection to a Moodle instance with enabled web services.
  • Needs an API authentication token or API key credential configured in n8n to authorize requests.
  • Moodle web services must have the function core_user_create_users enabled for the API user.
  • The node uses HTTP POST requests to Moodle's REST API endpoint.

Troubleshooting

  • Common issues:

    • Missing required fields (username, password, firstname, lastname, email) will cause errors.
    • Insufficient permissions or missing web service functions in Moodle may result in authorization errors.
    • Invalid or expired API tokens will prevent successful communication.
    • Providing invalid country codes or timezone strings in additional fields might cause validation failures.
  • Error messages and resolutions:

    • "Invalid parameter": Check that all required parameters are provided and correctly formatted.
    • "Access denied" or "Unauthorized": Verify API credentials and permissions in Moodle.
    • "User already exists": Ensure the username or email is unique before creating a new user.
    • Network or connectivity errors: Confirm Moodle server URL and network accessibility.

Links and References


If you need summaries for other resources or operations, feel free to ask!

Discussion