This page provides a brief overview of key interactions between your add-on web application and the Google Classroom add-ons API.
Attachment Discovery iframe
The Attachment Discovery iframe is the landing page for teachers in your add-on. Consider taking the following actions regarding this view:
Show your content discovery or creation UI.
Optionally, determine whether the stream item will accept student responses, as you might want to prevent the teacher from adding activity-type attachments. Check the value of the
itemType
query parameter that was passed when the add-on iframed opened. Only thecourseWork
type accepts student responses.Based on teacher selections, make one or more add-on
create
requests to add attachments to the assignment.
Other iframes
The Student View iframe, Student Work Review iframe, and Teacher View iframe are all intended to present content to the user rather than modifying a Classroom assignment. Consider taking the following actions regarding these views:
- When an iframe opens, get the user's OAuth consent and then validate their role and attachment ID.
- When an iframe opens, make a
courseWork.GetAddOnContextRequest
,courseWorkMaterials.GetAddOnContextRequest
orannouncements.GetAddOnContextRequest
based on theitemType
to validate user role. - If the current user is a student, associate the
submissionId
from the response with the student work. This is required for passing back grades and for showing student work to teachers in the grading tool; thesubmissionIds
match across views. - If the
attachmentId
is already known to the add-on, show the appropriate attachment UI. - Otherwise, it must be the case that the parent post of this attachment was
copied from another post or course. Use
copyHistory
to identify the most recent copy that the add-on is aware of and copy the settings from it to create a new corresponding model of the attachment on the add-on side. Then, show the appropriate attachment UI.