Setting up a Moodle integration

This article helps IT personnel set up the integration between Moodle and Peergrade

David Kofoed Wind avatar
Written by David Kofoed Wind
Updated over a week ago

Setting up your Moodle instance with Peergrade should be done in two parts. First, you need to add Peergrade as a web service and second, add it as a an external tool to your institution on Moodle.

Having trouble with the size of the iframe in Moodle? Check the section "Iframe size" at the bottom of this article.

Part 1: Add Peergrade as a web service

First you need to log in to an account that has admin rights to your Moodle instance. Then, go to Site administration > Plugins > Web Services.

On this page Moodle should provide you with an overview of how to set up a web service. This guide will go through each step and explain what information you need to provide.

Step 1
Click on Enable web services, check the box and click Save changes.

Step 2
Navigate back to the guide and click on Enable protocols. Click the eye icon for REST protocol to enable it and click Save changes.

Step 3
Now you need to create a user. From the Web services page (Site administration > Plugins > Web services) click on Create a specific user. Type in the following information in the form:

  • Username should be peergrade-webservice-user.

  • Set the authentication method to Manual accounts. Anything except 'No login' should work though (See: The Moodle API docs).

  • Set a password for the user.

  • After you've set a password, open the dropdown for the authentication method again and select Web service authentication.

  • Make sure the checkbox for "Force password change" is not checked.

  • Add the first name Peergrade and surname User

  • Add an email for the user. Any email that you have access to should work.

  • Leave all other fields empty.

When you've filled out the form click on Create user.

Step 4
Now we need to assign a role to the user with the correct capabilities. To create this role you have to:

  • Go to Site administration > Users > Permissions > Define roles.

  • Scroll to the bottom and click on Add a new role.

  • Leave the first form untouched and click Continue.

  • In the short name input field type in peergrade-webservice-role

  • In the custom full name filed type in Peergrade webservice role

  • In context types where this role may be assigned check the box for System.

  • Scroll down to Capability. Here you'll have to set the following permissions to 'Allow':

Use REST protocol
webservice/rest:use

###########################################################
### The following capabilities are needed for importing ###
### students from Moodle on app.peergrade.io (not using ###
### LTI)                                                ###
###########################################################
See full user identity in lists
moodle/site:viewuseridentity

View courses without participation
moodle/course:view

View participants
moodle/course:viewparticipants

View user profiles
moodle/user:viewdetails

View hidden details of users (Moodle states that this is needed for `core_user_get_users_by_field` but it seems that it's not strictly required)
moodle/user:viewhiddendetails

Enable/disable email address (Moodle states that this is needed for `core_user_get_users_by_field` but it seems that it's not strictly required)
moodle/course:useremail

Update user profiles (Moodle states that this is needed for `core_user_get_users_by_field` but it seems that it's not strictly required)
moodle/user:update

###########################################################
### The following capabilities are needed for importing ###
### groups and groupings from Moodle when using LTI     ###
###########################################################
Access all groups
moodle/site:accessallgroups

Manage groups
moodle/course:managegroups
  • Click on Create this role.

When you've saved the role you need to move it from existing users to potential users. You do this by:

  • Going to Site administration > Users > Permissions > Assign system roles

  • Click on Peergrade webservice user

  • Search for Peergrade User in the search field under Potential users.

  • Select it and click on the Add button between the two columns.

  • The change will save automatically. Refresh the page to make sure that Peergrade User is in the Existing users column.

Step 5

  • Go to Site administration > Plugins > Web services > External services.

  • At the bottom of the page click on Add to add a new web service.

  • Give it the name Peergrade web service and the shortname peergrade-web-service.

  • Check the box Enabled.

  • Check the box Authorised users only.

  • Click on Add service.

  • Click on Add functions.

  • In the searchable select field you will need to add the following 6 functions:

core_enrol_get_enrolled_users:Get enrolled users by course id.

core_enrol_get_users_courses:Get the list of courses where a user is enrolled in

core_group_get_course_groupings:Returns all groupings in specified course.

core_group_get_groupings:Returns groupings details.

core_group_get_group_members:Returns group members.

core_user_get_users_by_field:Retrieve users' information for a specified unique field.
  • Click on Add functions, check that all 6 functions are there and click on Add functions again.

Back in the overview of external services (Site administration > Plugins > Web services > External services) click the Authorised users link in the row with Peergrade web service. Here you should add the Peergrade webservice user to the list of authorised users. Search for Peergrade User in the search input under Not authorised users, select it and click on Add. The change should save automatically. Refresh the page to make sure the user in the Authorised users column.

Step 6

  • At the bottom of the Web services page in the Site administration (Site administration > Plugins > Web services), scroll to the bottom and click the Add link under the Manage tokens section.

  • On this page, for User you should select the Peergrade User and for Service you should select Peergrade web service. The IP restriction field can be left blank, and the Valid until fields can be left unchanged (disabled).

  • Click on Save changes.


You should now have a token key available. Inside Peergrade, go to your Institution dashboard > Settings > LMS integration, select Moodle and paste in the token and your platform's URL (https://www.example-platform-name.com) and click on Save changes.

Part 2: Adding Peergrade as an external tool

Now it's time to add Peergrade as an external tool. Go to Site adminsitration > Plugins > Category: Activity modules > Category: External tool and click on Manage tools.

On the Manage tools page you should click configure a tool manually.

Now you can set up the Peergrade LTI integration by filling out the form with the following information:

  • The Tool name should be Peergrade

  • The Tool description should be "A tool for creating peer feedback and peer grading assignments"

  • The Consumer key and Shared secret is available inside Peergrade if you go to your Institution dashboard > Settings > LMS integration and select Moodle. Copy and paste them into their respective input fields in Moodle.

  • Custom parameters should be left empty

  • For Tool configuration usage you should select "Show in activity chooser and as a preconfigured tool"

  • We recommend setting the Default launch container to New window.

  • Then click the Show more... link. After this the Icon URL and Secure icon URL fields will appear.

  • Click on Save changes

All teachers within the institution is now able to use Peergrade inside Moodle. To see how you set up an assignment with Peergrade inside Moodle check out this guide: http://help.peergrade.io/integrations/how-to-s-for-teachers/moodle-lti-integration

Iframe size

If Peergrade appears too small in your Moodle setup, you have three options (besides the default) on what you can do. All these options live under the Default launch container in the settings of the external tool in Peergrade

Here you can choose:

  1. Embed
    This is the default. Depending on your Moodle setup, this may or may not give you Peergrade iframe inside Moodle that is too small.

  2. Embed, without blocks
    This option will still have Peergrade live inside an iframe inside your Moodle setup, but it removes some of the buttons and spacing around the iframe leaving more space for Peergrade

  3. Existing window
    With this option, clicking a Peergrade activity in Moodle take you directly to Peergrade in the same window, replacing . This can make it hard for students and teachers to get back to Moodle, after having used Peergrade. For this reason, we recommend the New window option instead of this one.

  4. New window
    With this option, clicking a Peergrade activity in Moodle opens a new window with Peergrade inside of it. This is the best option in terms of amount of space available, but with a slightly less smooth and integrated experience compared to Embed and Embed, without blocks

Did this answer your question?