Moodle

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

Overview

This node integrates with the Moodle Learning Management System (LMS) to manage courses programmatically. Specifically, the Course - Create operation allows users to create new courses in a Moodle instance by providing essential course details and optional additional settings.

Typical use cases include:

  • Automating course creation workflows when onboarding new training programs.
  • Bulk creating courses from external systems or spreadsheets.
  • Integrating Moodle course management into broader educational or corporate automation pipelines.

For example, an education administrator could use this node to automatically create a new course whenever a new semester starts, setting the course name, shortname, category, and other parameters without manual input.

Properties

Name Meaning
Course Name Full official name of the course.
Short Name Unique short identifier for the course (must be unique within Moodle).
Category ID Numeric ID representing the category under which the course will be organized.
Additional Fields Optional extra settings for the course:
- Description Summary or description text for the course.
- ID Number External system identifier for the course.
- Format Layout format of the course; options are: Topics, Weekly, Social, Single Activity.
- Number of Sections Number of sections or weeks in the course (default 10).
- Start Date Course start date/time.
- End Date Course end date/time.
- Visible Boolean flag indicating if the course is visible to students.
- Make Shortname Unique If true, appends a timestamp to the shortname to ensure uniqueness automatically.

Output

The node outputs JSON data representing the newly created course as returned by the Moodle API. The output includes all standard course fields plus two additional flags:

  • _created: A boolean set to true indicating the course was successfully created.
  • _shortname: The final shortname used for the course, including any appended timestamp if uniqueness was enforced.

Example output snippet:

{
  "id": 123,
  "fullname": "Introduction to Biology",
  "shortname": "bio101_1680000000000",
  "categoryid": 1,
  "summary": "Basic biology course",
  "format": "topics",
  "numsections": 10,
  "startdate": 1680307200,
  "enddate": 1682899200,
  "visible": 1,
  "_created": true,
  "_shortname": "bio101_1680000000000"
}

No binary data is produced by this operation.

Dependencies

  • Requires a valid connection to a Moodle instance with web services enabled.
  • Needs an API authentication token or API key credential configured in n8n to authorize requests.
  • The Moodle web service must have the function core_course_create_courses enabled for the authenticated user.

Troubleshooting

  • Duplicate shortname error: If the shortname already exists, the creation will fail unless "Make Shortname Unique" is enabled, which appends a timestamp to avoid conflicts.
  • Invalid category ID: Ensure the category ID exists in Moodle; otherwise, the API will reject the request.
  • Date format issues: Start and end dates must be valid ISO date strings; they are converted to Unix timestamps internally.
  • Permission errors: The API user must have permissions to create courses; otherwise, the request will be denied.
  • Empty or missing required fields: The node requires fullname and shortname; missing these will cause errors.

If the node throws errors related to the web service call, verify that the Moodle site’s web services are properly configured and that the API credentials have sufficient privileges.

Links and References

Discussion