Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
This is likely not the first time this has been asked. I want to turn off notifications for observers from the courses where they are enrolled only as an observer (i.e. leaving their regular notifications enabled in courses where they are, say, the teacher).
This _feels_ like it should be setting somewhere. But…
I know that in the UI I can disable notifications from a course as _a_ user.
I know that I can replicate this _for myself_ via GraphQL (see `DisableCourseNotifications` below). And that I can pull out a list of all active observers via GraphQL (e.g. `AllObservers`) below. But I can't figure out how to wed the two together to then go ahead and disable the notifications for those observers in GraphQL, not least because the `updateNotificationPreferences` seems to only operate for the active user, and it's not apparent to me how to masquerade as another user in GraphQL..
Meanwhile, I can also pull an equivalent list of active observers from the REST API. And I can masquerade as other users in the REST API. But I cannot disable notifications at the course level via the REST API (unless I'm missing something). I can disable _categories_ of notification (e.g. `course_content`) but not from specific courses.
I can even tie this together offline, e.g. writing a script to pull the list of observers and then apply the mutation for each observer one at a time… if I could only masquerade in GraphQL.
Anyone of insights or suggestions?
mutation DisableCourseNotifications($courseId: ID!) {
updateNotificationPreferences(
input: {contextType: Course, courseId: $courseId, isPolicyOverride: true, enabled: false}
) {
user {
_id
notificationPreferencesEnabled(contextType: Course, courseId: $courseId)
notificationPreferences {
channels {
_id
path
pathType
notificationPolicyOverrides(contextType: Course, courseId: $courseId) {
notification {
_id
category
categoryDisplayName
name
__typename
}
__typename
}
__typename
}
__typename
}
__typename
}
errors {
message
__typename
}
__typename
}
}
query AllObservers {
__typename
allCourses {
_id
enrollmentsConnection(filter: {types: ObserverEnrollment, states: active}) {
nodes {
user {
_id
email
name
}
}
}
}
}
To participate in the Instructure Community, you need to sign up or log in:
Sign In