A daemon made in Google App Script (GAS) to crawl NCKU Moodle calendar events(assignment) and sync them to Google Calendar, also send email notifications for assignment updates.
中文版的 README 請參考 這裡
- Sync assignment events to Google Calendar automatically
- Present assignment submission status with color in Google Calendar
- Send email notifications for new assignment
- Send email notifications for assignment deadline updated
- Store token, storing account and password is optional (A token valid for about 3 months. If password stored, token will be updated automatically)
- This GAS project is standalone, open source and totally under your own Google account, no data will be sent to any other server.
- If you are still worried about your Moodle account and password, you can remove them from GAS project after initialization. (But you need to refill them if token revoked, moodle's is valid for about 3 months.)
Make sure you read Reminder Notice carefully before actually operate setup.
- Login your Google account in browser.
- Visit GAS project: NCKU Moodle Calendar Prototype and go to
Overview
to make a copy under your Google account. - Open the copied project, go to
Project Settings
to add propertiesmoodleid
andmoodlekey
and fill in your Moodle account and password. - Go to
Editor
and selectInititalize.gs
then clickRun
to initialize the project. Script will create a calendar calledMoodle Calendar
under executor's account and sync existed event. (You may need to authorize the project to access your Google account) - (Optional) You can delete the
moodleid
andmoodlekey
after initialization if you don't want leave your Moodle account and password in GAS project. (But you need to refill them if token revoked) - Go to
Triggers
and add a trigger tomain
, setevent source
toTime-driven
,type
toHour timer
,interval
to 6 hours and clickSave
. (The interval presents the sync frequency. Don't set too short interval to avoid making overload to Moodle server)
- Don't make too short interval in trigger settings, it may cause overload to Moodle server.
- Don't add event to
Moodle Calendar
manually, it will be removed by script. - The Google account you set the trigger and grant premission will be the executor of this project.
- Calendar events will be created under executor's account.
- Notification email will be sent to executor's email.
Event Color | Status |
---|---|
🟢 Green | Submitted |
🟡 Yellow | Not submitted |
🔴 Red | Overdue |
🔘 Gray | Not open yet / No submission required |
Evnet time is from 00:00 to submission deadline.
This project need following premissions:
Premission | Feature |
---|---|
See, edit, share, and permanently delete all the calendars you can access using Google Calendar |
Sync assignment events to Google Calendar. |
Connect to an external service |
Fetch data from Moodle. |
Send email as you |
Send email notifications. |
Under Main.gs
function main, there are some settings about notification, you can modify them to enable or disable notification.
Settings | Default | Feature |
---|---|---|
enableNewEventNotify |
true |
Send notification if new assignment available. |
enableEditEventNotify |
true |
Send notification if assignment deadline updated. |
You can set interval of error notification sent to your email in trigger settings. GAS will send error notification to your email if any error occured.
- Excpetion occured when fetching data from Moodle, may be caused by Moodle exception or connection issue. Ignore if not occured continuously.
- If your account and password is removed after initialization, refill them and run
main
to gain new token.
- Check your Moodle account and password in properties is correct.
- If all of them is not working, maybe Moodle is under bad condition, try again later.
- 2023/12/6 (0494aeb): Use batch call in
core_calendar_get_calendar_monthly_view
to reduce request count. - 2023/12/12 (7c17937): Use REST API to reduce request count.
- 2023/12/13 (eea0db4): Fix submission type
teamsubmission
not handled. - 2024/1/31 (f41649a): Fix google calendar event duplicate due to date range generating bug.