Moodle Integration with DialogFlow(chatbots)

MoodleThis writeup describes the approach and steps taken to integrate Google DialogFlow products with the Moodle open-source learning management system (LMS) platform. Moodle stands for Modular Object-Oriented Dynamic Learning Environment. Founded and developed by Martin Dougiamas in 2002, Moodle was designed to provide educators, administrators, and learners with an open, robust, secure, and free platform to create and deliver personalized learning environments. Moodle is a user-friendly Learning Management System (LMS) that supports learning and training needs for a wide range of institutions and organizations across the globe.

Today, Moodle is the most widely used Learning Management System in the world, with well over 100,000 registered implementations worldwide supporting over 150 million learners. Moodle’s open source project is managed by a dedicated team at Moodle HQ with a head office in Perth, Australia, and satellite offices around the world. Moodle’s modular nature and inherent flexibility make it an ideal platform for both academic and enterprise-level applications of any size.

Moodle Numbers

Problem Definition

Integrate Google Chatbot with the Moodle platform to provide online information to students seeking clarifications around their course curriculum. The proposed integration is for a University to aid/assist in information triage and provide a speedy response (real time) to questions and queries on interest. The area of focus is on student needs and addresses the academic, enrollment, student life questions and clarifications.

Approach

The chatbot is created using the Dialog Flow framework. A GCP account is required to create a bot using a dialog flow framework. The database that is used for storing student’s information is Google Firestore. When a query is made, the Dialog Fulfillment makes a call to the Google Firestore database and fetches the required information and displays it to the user.

Integration Steps

Dialog flow natively provides integrations with platforms like Slack, Facebook messenger, etc. To integrate the Dialog Flow chatbot with any website, under the integrations tab in the Dialog Flow interface, Web demo gives us the chatbot installation script. This script can be included in the website front end code.

There are some limitations to web demo integration provided by Dialogflow. Buttons won’t work properly, even links will not get redirected.

So to overcome this problem, there is a third-party tool called “Kommunicate”. The first integration is done with Kommunicate. Kommunicate also gives us the chatbot installation script which can be included in the website front end code.

Instructions for integrating dialog flow chatbot in Moodle websites:

  • Create a moodle cloud account
  • Log in to your Moodlecloud website
  • Click on “Site Administration”
  • Click on “Appearance”
  • Open “Additional HTML”Paste the Kommunicate installation script in the “Before BODY is opened” text box and refresh the page

Chatbot Workflow
(Step by step process)

Chatbot Workflow

Solution Architecture
(With GCP services used)

Solution Architecture

Detailed Instructions/Runbook

  • Navigate to https://dialogflow.cloud.google.com/ and create a Dialog Flow agent. To create a dialog flow agent, a GCP account is required. Only one agent can be created per GCP account
  • Create a Google Cloud Firestore database to store the Student information
  • Responses to the Dialog Flow intents are created using Dialog Flow fulfillment. This Fulfillment makes a call to Cloud Firestore and fetches the student details when a query is made by the end-user
  • Currently, the bot answers student’s queries like Enrolled Courses, Grades, Deadlines, University reopens questions
  • Once the chatbot is created using the Dialog Flow framework, the next step is to integrate the bot with the moodle website
  • To integrate the bot with a website, we need an installation script
  • Navigate to “kommunicate.io” and create an account in Kommunicate, a third-party tool to get the chatbot installation script. Go to “Bot Integration” from the menu bar and integrate with Dialog Flow by uploading a service account of the GCP account
  • After the integration is done, Kommunicate gives the chatbot installation script. This script can be used for integrating with the website
  • Create an account in the moodle cloud. Copy the script obtained from the above step into Additional HTML block of moodle cloud website to integrate our bot with moodle

Challenges

To integrate the Dialog Flow chatbot with any website, under the integrations tab in the Dialog Flow interface, Web demo gives us the chatbot installation script. This script can be included in the website front end code.

There are some limitations to web demo integration provided by Dialogflow. Buttons won’t work properly, even links will not get redirected, customizing chat widget is also not possible.

In order to overcome this problem, there is a third-party tool called “Kommunicate”. The first integration is done with Kommunicate. Kommunicate also gives us the chatbot installation script which can be included in the website front end code.

We will keep you posted here as we develop more integrations and use cases with DialogFlow and Moodle.

Please check out our video blog where we walk through a demonstration of the workflow above. Or check it out directly on YouTube:

For more information about how SpringML can support your team with data modernization projects, feel free to contact us at info@springml.com or find out more about our services at https://springml.com/cloud-migration/