Blog 4 | Development 1 | George Lipceanu
March 27th, 2026.
This week's sprint focused on our own individual developments. I was put on the Google Classroom functionality for this sprint, which I worked on throughout and finished in this sprint.
Google Classroom - What is it, why use it, and how the BinBot will use it
Google Classroom is a popular learning management app that allows for classroom materials or announcements to be published in a classroom space. Teachers can create a classroom for their students where they can view materials online as opposed to only being able to view them in person or in a physical format.
As discussed in the last blog, my work was to set up a Node-RED environment that allows for notifications and alerts to be sent automatically to the Google Classroom, which came with a lot more challenges than I had initially anticipated. The following section will cover the steps taken for getting this set up, both on the Google API side and the Node-RED side.
In order to get BinBot functionality with Google Classroom, it was important to outline the main goals and vision for how this system was going to function from a user/teacher point of view. My vision for this was somenthing along the following lines:
- A teacher goes onto some website or gets some type of message where they have to accept that they want to use the BinBot for their Google Classroom.
- This sends an invitation trigger to a BinBot account which accepts the Google Classroom invite.
- The BinBot can freely make messages from there, whether that be certain alerts or weekly reports.
Google API and Credentials Setup
An OAuth 2.0 client ID was set up and served as the unique identifier for the BinBot application. It allowed Google to verify the app's identity and securely manage permissions between the teacher's classroom data and the BinBot master account.
The 2 Authorised redirect URIs are all the links that this application is allowed to visit and will be covered within the following sections. For the sake of getting an idea brief rundown, the oauthplayground URI is a website that generates refresh tokens for the BinBot account which are then used by Node-RED to do what it needs to do with the account (for example, send an alert), and the 2nd URI is a simple Ngrok tunnel that allows me to host my Node-RED application to the internet, which is needed when actually visiting the website to consent to and invite the BinBot to a classroom.
An OAuth Consent screen was also set up for this applications which allows users to consent to certain privileges that the app/BinBot will be using.
Node-RED and NGROK Setup
The following Node-RED flow was used to provide this website structure for a user looking to accept the BinBot:
Full Guided Flow from User Side
The following Node-RED flow was used to provide this website structure for a user looking to accept the BinBot:
1. Lecturer clicks this link:
https://accounts.google.com/o/oauth2/v2/auth?client_id=499189934931-g3svfggq3ru1g036csqoge167trn77m0.apps.googleusercontent.com&redirect_uri=https://terbic-gastrotomic-signe.ngrok-free.dev/oauth-callback&response_type=code&scope=https://www.googleapis.com/auth/classroom.announcements%20https://www.googleapis.com/auth/classroom.courses.readonly%20https://www.googleapis.com/auth/classroom.rosters&access_type=offline&prompt=consent
NOTE: If attempting recreation of this setup, many things in this link need to change, such as client_id, redirect_url, etc.
2. They are led to this screen where they have to accept these permissions:
3. Then they are brought to this website where they choose which classroom to add the BinBot to a specific classroom:
Once the button is pressed and a successful request is sent, this will be returned:
Note: At the moment there is code to automatically accept from the BinBot account however, due to API restrictions on personal accounts this doesn't work but (theoretically) the account would be able to accept if it was an organisation account.
This next section of the same flow allows for alerting and notifications in Google Classroom:
This flow of nodes does the following:
- Takes in MQTT values (in this test case, takes in input3 with tile value 1085
- Puts it through switch node to filter through specific input IDs (that being input3 here)
- Checks if value is greater than 1050 (which implies it fell or is tilting greatly) - if it is then prepare a message to be sent into Google Classroom, if not then drop the rest of the flow here
- Gets all relevant courses to send this alert to
- Posts the alert to these courses
Now the BinBot can send alerts from Node-RED.
Security Note: At the moment there are sensitive Google tokens being sent over unencrypted HTTP, which is a big security risk. Due to time constraints there is nothing to obscure these and is something to cover for future work in this project.
Remaining Work
My remaining work includes adding an email pub/sub service to this Node-RED flow that allows users to opt-in via email. This is different from the previous email implementations covered in my previous blogs since this requires a dedicated server sending emails as opposed to having Node-RED send emails via your own email address. On top of this, there needs to be a way these are populated automatically since a teacher or anyone opting in won't have access to the actual Node-RED code. So there needs to be an autonomous system put in place to provide this.
Comments
Post a Comment