@JoeSpruce, @nathanboettcher
We have a Canvas Student Orientation course that the student must complete before they are allowed access to their real courses. We have a specific assignment that indicates completion of the course (and they have to score at least 80% as well).
The way we check this is by polling, not by notification. Every 20 minutes, I get the list of submissions for that assignment to see who has completed it. Since we remove them from the course after they complete it, the list of people who have completed it is short and quickly returned.
The REST API call to get that allows you to specify submissions since a particular date and time, so I use that to make it a fast call, rather than having to return submissions for every student in the course. Better yet, use GraphQL as it only returns those where the student has actually submitted the assignment and it's faster and you usually don't have to worry about pagination.
Here's the GraphQL query I use. You can try it on your site by adding /graphiql to the end of your dashboard URL.
query orientationCompleters($assignmentId: ID) {
assignment(id: $assignmentId) {
submissionsConnection {
nodes {
userId
score
user {
sisId
}
submittedAt
}
}
}
}
At the bottom is a Query Variables section. You'll need to add the assignment ID there. Be sure to use the Canvas assignment ID for the assignment that marks the end of the course. If it's a Classic Quiz, you need to get the assignment ID, not the quiz ID.
{
"assignmentId": 3927467
}
Then click the Run (triangle) at the top.
Once you get it working properly, you can automate it using the REST API to make a GraphQL call.
You can also use Canvas Live Events to accomplish this.
The course_completed event is sent when all of the module requirements in a course are met. There's another time it's sent, but that's the one you would want.
I set up an Amazon SQS queue for receiving my Live Events. If all you're getting are notifications of course completions, it may even be free (my AWS account gets 1 million free requests per month). We're a small college and I gather asset views and some other things and it rarely costs me more than $1 per month. You still have to retrieve the data from AWS, which I do every 5 minutes. The delay may be a little longer than 5 minutes since you have to wait for the item to hit the queue and then be exposed to you.
Even with notifications, I'm still polling to get the message. I would recommend the first way as it's a lot faster to get up and going.
Live Events have the concern that Canvas makes a best attempt to deliver the notification. It may not get through, so you will need a fallback system. The first method of polling Canvas directly doesn't have that issue and would be the fallback. You can up the frequency of polling if you like, but every 20 minutes works well for us.
@Wimpress, thanks for asking about this. If you hadn't brought it back up, I never would have seen the question to be able to respond.
I wouldn't get too worked up over it being a year without an answer though. There was no follow-up after the message from an Instructure employee regarding whether it answered the question. Given the nature of the Community, that could have just as easily been an acceptable answer that no one marked or it could have been one that didn't work. It's really hard to tell; I've given lots of responses that I feel answer the question, but the original author never came back to acknowledge it or respond. Unfortunately, most people who stumble across this question do not have the knowledge to answer this question or even know if the answer given wasn't meeting people's needs.