Skip to content

Repository files navigation

CanvasChirp

Canvas LMS submission and comment monitoring

Installation

Prerequisites

  • A Canvas LMS access token (from your Canvas account settings)

Setup

Setup uv:

uv sync

Create a token file in the project root and paste your Canvas access token, or:

echo "your-canvas-api-token" > token

Run

Before running the main script, you need to set constant for groups and fetch students group mapping:

# For example "https://canvas.tue.nl/courses/32560/groups#tab-25446"
GROUP = 25446
uv run fetch_groups.py

Then, edit the constants in main.py:

API = "https://canvas.tue.nl"
COURSE_ID = 32560
ASSIGNMENT_ID = 146386

Then, run the script:

uv run main.py

Course comment notifier (Teams + GitHub Actions)

notify_course_comments.py monitors a single course and send only student-authored submission comments to a Teams channel via Teams Workflow Webhook alerts.

It uses student_groups.json to identify student authors, and keeps de-duplication state in a JSON file.

Local run

Set required environment variables:

export CANVAS_COURSE_ID="32560"
export TEAMS_WEBHOOK_URL="https://..."
export CANVAS_TOKEN="your-canvas-token"

Optional variables:

export CANVAS_API_BASE="https://canvas.tue.nl"                 # default: https://canvas.tue.nl
export STUDENT_GROUPS_FILE="student_groups.json"               # default: student_groups.json
export STATE_FILE="state/course_comment_dedupe.json"           # default: state/course_comment_dedupe.json
export FIRST_RUN_BEHAVIOR="baseline"                           # baseline | notify
export DRY_RUN="false"                                         # true|false (no Teams post, no state writes)
export TEAMS_WEBHOOK_MODE="auto"                               # auto | adaptivecard | messagecard

Run:

uv run notify_course_comments.py

FIRST_RUN_BEHAVIOR=baseline (default) stores existing comments in state without posting them, then posts only future comments.

Safe local verification:

DRY_RUN=true uv run notify_course_comments.py

GitHub Actions (daily run)

Workflow file: .github/workflows/course-comments-to-teams.yml

  1. Add repository secrets:

    • CANVAS_TOKEN
    • TEAMS_WEBHOOK_URL
  2. Add repository variable:

    • CANVAS_COURSE_ID
  3. Optional repository variables:

    • CANVAS_API_BASE (defaults to https://canvas.tue.nl if unset)
    • FIRST_RUN_BEHAVIOR (baseline or notify, defaults to baseline)
    • STATE_BRANCH (defaults to default if you keep workflow as-is)
  4. Ensure the state branch exists (only needed if you use a non-default branch for state):

git switch -c default
git push -u origin default
git switch -

The workflow runs daily and on manual dispatch, then commits only the de-dup state file (state/course_comment_dedupe.json) with [skip ci].

About

Canvas LMS submission and comment monitor - Chirp when there's new activity

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages