### Table of Contents
- **General App Information** - An introduction to Canvas LMS, its core features, and how ChatGPT Custom Actions supercharge education via AI-driven enhancements.
- **Authentication from ChatGPT to Canvas** - A breakdown of authentication approaches (OAuth and User-Generated Access Tokens) to link ChatGPT securely with Canvas, complete with step-by-step setup guides.
- **Sample Use Case: Student Course Assistant** - In-depth walkthrough of deploying ChatGPT as a student helper for course exploration, exam prep, and tailored feedback, featuring precise API endpoints and processes.
- **Other Use Cases for Consideration** - Further ideas for Canvas API integrations, like analytics dashboards and automated reporting.
- **Congratulations**
## General App Information
Canvas stands as a popular Learning Management System (LMS) tailored for online education and instruction. It provides powerful features for managing courses, distributing materials, conducting assessments, and fostering student interactions. Leveraging the Canvas REST API, it supports deep customization and seamless connections with external tools, such as AI solutions like ChatGPT.
By integrating ChatGPT’s Custom Actions with Canvas, instructors can harness AI to enrich course materials, streamline workflows, and deliver customized learning paths. Practical applications include AI-powered teaching aides drawn from live courses, ideal for fetching Canvas data to spark meaningful educational conversations. Note that ChatGPT Custom Actions aren't designed to fully replace Canvas or automate its entire interface—stick to Canvas for tasks it handles best.
## Authentication from ChatGPT to Canvas
For broader insights into authentication within Custom Actions, consult the Action authentication documentation.
Canvas supports two authentication methods: 1) OAuth and 2) User-Generated Access Tokens.
- OAuth is mandatory for multi-user or enterprise-scale implementations.
- For personal or single-user setups—especially without Admin access—User-Generated Access Tokens work well. Keep in mind that actions using this method execute under the user's token, logging activity as theirs and respecting their permissions.
### Implementing OAuth for Canvas
Although this guide skips a full OAuth demo, multi-user setups demand it. Refer to the OAuth for Canvas Documentation for a thorough tutorial.
Key points for OAuth in Canvas Custom Actions:
- Admin settings access is essential to obtain Client ID and Client Secret.
- Authorization URL format (replace with your Canvas instance URL): https:///login/oauth2/auth
- Token URL format (update Canvas Install URL): https:///login/oauth2/token
- Scopes might be optional in Custom Actions. Without a developer key requiring them or without specifying, the token gains full scopes. If scopes are required but unspecified, expect an "invalid_scope" error. Check developer keys here and endpoints here.
- Token Exchange uses Default (POST Request).
- Canvas calls it `redirect_uri`; ChatGPT terms it `Callback URL` for post-auth redirects.
### Implementing authentication with User Generated Access Tokens
User-Generated Access Tokens suit certain Custom Action scenarios with Canvas. Follow these steps:
- Navigate to Canvas Account Settings shown here:
- Scroll to the Tokens list shown here:
- Create a New Token, and **store this token securely**. It's irretrievable afterward.
## Sample Use Case: Student Course Assistant
### Overview
This AI helper guides students through their courses, delivering in-depth details, custom practice quizzes, and helpful feedback to boost comprehension and performance.
### Considerations
- API-fetched elements like the Syllabus arrive as HTML, unsuitable for direct ChatGPT display. Direct users to course descriptions, modules, and assignments instead.
- Use the `include[]` query parameter to pinpoint data. For targeted course details, include examples in GPT instructions.
### GPT Instructions
Multiple instruction styles exist. Explore prompt engineering tips here.
```
# **Context:** You support college students by providing detailed information about their courses hosted on the Canvas Learning Management System. You help them understand course content, generate practice exams based on provided materials, and offer insightful feedback to aid their learning journey. Assume the students are familiar with basic academic terminologies.
# **Instructions:**
## Scenarios
### - When the user asks for information about a specific course, follow this 5 step process:
1. Ask the user to specify the course they want assistance with and the particular area of focus (e.g., overall course overview, specific module).
2. If you do not know the Course ID for the course requested, use the listYourCourses to find the right course and corresponding ID in Canvas. If none of the courses listed returned courses that seem to match the course request, use the searchCourses to see if there are any similarly named course.
3. Retrieve the course information from Canvas using the getSingleCourse API call and the listModules API call.
4. Ask the user which module(s) they would like to focus on and use the listModuleItems to retrieve the requested module items. For any assignments, share links to them.
5. Ask if the user needs more information or if they need to prepare for an exam.
### When a user asks to take a practice test or practice exam for a specific course, follow this 6 step process:
1. Ask how many questions
2. Ask which chapters or topics they want to be tested on, provide a couple examples from the course modules in Canvas.
3. Ask 1 question at a time, be sure the questions are multiple choice (do not generate the next question until the question is answered)
4. When the user answers, tell them if its right or wrong and give a description for the correct answer
5. Ask the user if they want to export the test results and write the code to create the PDF
6. Offer additional resources and study tips tailored to the user's needs and progress, and inquire if they require further assistance with other courses or topics.
### When a user asks to create a study guide
- Format the generated study guide in a table
```
### OpenAPI Schema
- API Calls Featured
[GET] listYourCourses
- [GET] getSingleCourse
- [GET] listModules
- [GET] listModuleItems
- [GET] searchCourses
Below was generated with a combination of Canvas API Reference and the ActionsGPT.
```
openapi: 3.1.0
info:
title: Canvas API
description: API for interacting with Canvas LMS, including courses, modules, module items, and search functionalities.
version: 1.0.0
servers:
- url: https://canvas.instructure.com/api/v1
description: Canvas LMS API server
variables:
domain:
default: canvas.instructure.com
description: The domain of your Canvas instance
paths:
/courses:
get:
operationId: listYourCourses
summary: List your courses
description: Retrieves a paginated list of active courses for the current user.
parameters:
- name: enrollment_type
in: query
description: Filter by enrollment type (e.g., "teacher", "student").
schema:
type: string
- name: enrollment_role
in: query
description: Filter by role type. Requires admin permissions.
schema:
type: string
- name: enrollment_state
in: query
description: Filter by enrollment state (e.g., "active", "invited").
schema:
type: string
- name: exclude_blueprint_courses
in: query
description: Exclude Blueprint courses if true.
schema:
type: boolean
- name: include
in: query
description: Array of additional information to include (e.g., "term", "teachers").
schema:
type: array
items:
type: string
- name: per_page
in: query
description: The number of results to return per page.
schema:
type: integer
example: 10
- name: page
in: query
description: The page number to return.
schema:
type: integer
example: 1
responses:
'200':
description: A list of courses.
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: The ID of the course.
name:
type: string
description: The name of the course.
account_id:
type: integer
description: The ID of the account associated with the course.
enrollment_term_id:
type: integer
description: The ID of the term associated with the course.
start_at:
type: string
format: date-time
description: The start date of the course.
end_at:
type: string
format: date-time
description: The end date of the course.
course_code:
type: string
description: The course code.
state:
type: string
description: The current state of the course (e.g., "unpublished", "available").
'400':
description: Bad request, possibly due to invalid query parameters.
'401':
description: Unauthorized, likely due to invalid authentication credentials.
/courses/{course_id}:
get:
operationId: getSingleCourse
summary: Get a single course
description: Retrieves the details of a specific course by its ID.
parameters:
- name: course_id
in: path
required: true
description: The ID of the course.
schema:
type: integer
- name: include
in: query
description: Array of additional information to include (e.g., "term", "teachers").
schema:
type: array
items:
type: string
responses:
'200':
description: A single course object.
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: The ID of the course.
name:
type: string
description: The name of the course.
account_id:
type: integer
description: The ID of the account associated with the course.
enrollment_term_id:
type: integer
description: The ID of the term associated with the course.
start_at:
type: string
format: date-time
description: The start date of the course.
end_at:
type: string
format: date-time
description: The end date of the course.
course_code:
type: string
description: The course code.
state:
type: string
description: The current state of the course (e.g., "unpublished", "available").
is_public:
type: boolean
description: Whether the course is public.
syllabus_body:
type: string
description: The syllabus content of the course.
term:
type: object
description: The term associated with the course.
properties:
id:
type: integer
name:
type: string
start_at:
type: string
format: date-time
end_at:
type: string
format: date-time
'400':
description: Bad request, possibly due to an invalid course ID or query parameters.
'401':
description: Unauthorized, likely due to invalid authentication credentials.
'404':
description: Course not found, possibly due to an invalid course ID.
/courses/{course_id}/modules:
get:
operationId: listModules
summary: List modules in a course
description: Retrieves the list of modules for a given course in Canvas.
parameters:
- name: course_id
in: path
required: true
description: The ID of the course.
schema:
type: integer
- name: include
in: query
description: Include additional information such as items in the response.
schema:
type: array
items:
type: string
example: ["items"]
- name: search_term
in: query
description: The partial title of the module to match and return.
schema:
type: string
- name: student_id
in: query
description: Return module completion information for the student with this ID.
schema:
type: integer
- name: per_page
in: query
description: The number of results to return per page.
schema:
type: integer
example: ... [content truncated]
```