Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Hi All,
We've put together a script here at Strath to allow us to send messages to the observers of students from the Canvas Inbox (Conversations) and Marksbook ('Message Students Who...') pages. We're a K-12 institution, so while the ability to send messages to students who have not submitted their assignments is awesome, sometimes we need to let their parents know too! It looks a little something like this:
It's pretty simple. The script inserts some buttons on the 'Message Students Who...' and Inbox 'Send Message' buttons for inserting observers and removing students. Once clicked, the script does a few API calls in the background to determine who the observers of the students are and pops them in the recipient list.
Our CSM mentioned this might be something that other institutions might be interested in, so I've made the script and some instructions available here: https://github.com/sdjrice/msgobs.
If you decide to give it a crack, I'd be interested to hear how it goes! I've tested this with a demo Canvas instance and it's worked ok, but that's the extent of my testing.
All the best!
---------------
Download v0.07 Here: https://github.com/sdjrice/msgobs
---------------
Changelog:
Version 0.07 on 17/04/20
Version 0.06 on 11/10/17
Version 0.05 on 07/07/17
Version 0.04 on 06/07/17
Version 0.03 on 03/07/17
Version 0.02 on 15/03/17
Version 0.01 on 20/09/16
Solved! Go to Solution.
Hi all,
MSGOBS Version 1.01 is now available here https://github.com/sdjrice/msgobs with the following fixes:
Unfortunately I wasn't able to build in New Analytics, for for that overzealous promise, I am sorry. I didn't notice that the New Analytics LTI is hosted on a different domain which means that browser security features prevent the script from accessing what it needs. I'll keep an eye on it in the future.
@dlourcey Thanks for the feedback Don, I'm truly glad to hear about this positive effect!
@christopher_gil I'm afraid that is the expected behaviour, as replies in conversations always create group messages rather than individual messages (the 'send individual checkboxes' element doesn't exist on a reply). Your feedback though inspired me to put a warning in for the teacher when they choose to include observers on a reply message. I'll address this problem further in a future update.
EDIT: 1.01 fixes issue with Safari web browser.
New version 0.02 available here: https://github.com/sdjrice/msgobs
Fixes an issue which caused some messages to fail when sending from the gradebook view.
Correct, this script does apply to the Inbox as well, and adds a little 'include observers' button there too!
Fantastic. I look forward to trying it out. -Joe
Version 0.03 now available here: https://github.com/sdjrice/msgobs
- Adds support for sending messages to any kind of group in the inbox view.
Stephen,
I'm excited to try this out. I saw the inherent problem with this in that you could easily hang the system if you are trying to look up too many Observers. Are there any limitations or quirks to this we should be aware of?
It shouldn't totally hang hopefully, I think instead it's just going to take a little while haha! I'm assuming this is happening when, as an account admin, you add a group of students without selecting a course from the course dropdown. When operating in this way the script performs the following:
That 160 lookups is a bit time consuming, especially as it hits the API rate limit API Rate Limiting (the requests are made concurrently). If you select a course first, then it would only look up students within that course (20x1), so that would be a lot quicker.
Why not limit the recipient lookups to the course they were specified from, even when the user doesn't select it? Well, some groups that you add have no course information attached (e.g sections and groups) so they require extra lookups to see what that course belonged to etc. In our institution, no teachers actually have the role where they can add users without first selecting a course, so I just left it with this slow method. That said, If this usage scenario that I've described above applies to you, I could possibly have a look at limiting those admin role lookups to apply only to the courses to which the group belongs How many students are you wanting to look up at a time (ideally) Joe?
I've also just realised I've forgotten to cull duplicate course lookups (occurring when students are enrolled in the same course), so that's a bit dumb. Might go fix that. That may actually speed it up substantially, and might not hit the API limit so hard.
Ok, I have new version for you, 0.04 uploaded to github https://github.com/sdjrice/msgobswhich won't look up the same course twice anymore. That cuts down the number of API calls dramatically because we're not hitting the server for things we already know, which was especially a problem when using whole groups of students. Whoops.
Still a bit slow without a course selected, but much better . Takes around 30 seconds for 73 students here, quicker if there's more crossover in their course enrolments.
Awesome stuff Stephen. I can't tell you how much this new communication capability will help our teachers. Previously they had to use the SIS to easily communicate with students AND parents. Often parents will have a last name, so there is no way to tell who belongs to who. This functionality you built solves all of that and now our teachers will be able to stay in one system.
So, I have one final request... Is it possible to make the "Send an individual message to each recipient" option be checked by default? There is zero reason why messages shouldn't be individual. If they aren't you run into the 'reply all' issue and sometimes even privacy issues. Thanks for all you do.
Done Joe, just for you! You can download 0.05 with the change you suggested here (as usual) https://github.com/sdjrice/msgobs. It is actually a really good idea; we've had a small debacle around that checkbox in the past. So thanks, that's helpful for us too, and no worries!
One more thing Joe which you may soon encounter, as we did, is this issue mentioned here: https://community.canvaslms.com/ideas/8403-download-an-admin-report-of-all-bouncing-email-addresses".... What happens is that Canvas sometimes determines that a user's communication channel is bouncing email messages and stops sending email notifications to that address without any notification to admins (the user is notified, but only when they log in to canvas). This will include of course your nicely created observer messages. Make sure you give that issue an upvote .
My workaround is the use of another script which at night crawls through every user in our Canvas instance, masquerades as them and then checks to see if that user has the notification that one of their email channels is not working. It then sends us an email about those accounts which aren't receiving emails anymore and we give them a ring.
Weirdly, although the canvas documentation (Canvas Production Release Notes (2015-04-25) see Notifications heading) on this issue says that full mailboxes and other temporary problems are not supposed to be flagged, we found that when I first ran this script there were about 13 users with bouncing email flags, but only 2 were actually bouncing when we sent them a regular email. What I figured from this situation was that temporary issues had been flagged (bills not paid?), and if Canvas had just tried to send an email notification again, everything would have been fine.
Bit annoying when you want to rely on Canvas for parent teacher communications, but I think we're on top of it with the nightly check. There were some other solutions put forward on the ideas page, so you may want to consider checking out whether they'll work easily for you. I haven't really looked at them yet. I'm of course happy to share this script, but it's a little on the hairy side haha. It would require node.js installed on a server, and installing a few packages with NPM.
All the best and I'm glad you've been able to make use of the script!
Hi everyone, just added this script to our Instance but saw a couple of weird oddities. @Steve_25 @joseph_allen have either of you seen this?
by default in the Inbox, the Send an individual message to all is checked as default. This has caused havoc on inbox messages.
For example:
Any insight would be great. We are not using Tamper, just straigth uploading in Themes Java.
Thank you for sharing this script!
No worries, Martha! My pleasure.
Hi Stephen, We installed the code your wrote for the Messaging of Observers and it has been working great. Recently we received a support call from one teacher who it does not work for, and we can't figure it out. I've attached a screen shot. It works in this teacher's Inbox, but not in the Message Students Who. There does not appear to be anything different about this teacher's course than any of the others that do work. All others we've checked are working fine. I wanted to see if you have any ideas on why it may not work for this one or things we should look at?
Hi Joe,
That's a bit odd! Couple of things we can try:
New version 0.06 available here: https://github.com/sdjrice/msgobs
- Fixes an issue with courses containing more than one hundred enrolments. Thanks Joe for discovering that one.
@Steve_25 , we ran into an issue today with the Include Observers button. One of our teachers was no longer able to add observers to a Conversation sent to an individual student. The button worked fine when all students in the course were selected, and everything worked fine for me in my test accounts. What I found was that our teachers don't have permission to use the search users API (api/v1/courses/{course_id}/search_users?search_term={user id}) that you were using in your script. I don't know if Canvas made a change to the API permissions or if it's a permission setting on our end that's causing the issue, but I swapped out the search users API with the course users API and that got us back up and running.
switch (v[0]) {
case 'user':
if (results.contexts[0] === 'none') {
options = {
mode: 'users',
id: v[1],
query: '',
type: ''
};
} else {
options = {
mode: 'courses',
id: results.contexts[0],
//query: 'search_users?search_term=' + v[1],
query: 'users/' + v[1],
type: ''
};
}
Thanks for pointing that out Audra. I've included your suggested endpoint change in the most recent update. Only a two year turnaround!
Our teachers love your script, Stephen!
Is there any way to include the name of the student in the message or subject of the message? I would be mostly helpful when observers with more than one child get the emails. I am no coder but any idea on how I could make that work would be really appreciated.
Thank you so much!
Hi Cynthia,
Glad to hear your teachers have been finding it helpful!
Unfortunately it's not possible to include the name of the students without some coding intervention, but the good news is that including the student's name would definitely be possible. It would require a bit of a rework to a few elements as the script currently sends bulk messages and would need to have the ability to send individual messages, but nothing too strenuous. It's something I've had in mind for a while, but assumed that this functionality would get written into Canvas before I had the chance to do so (see this idea here: https://community.canvaslms.com/ideas/7919-message-observers-of-students-who-in-grade-books?commentI... ).
What might work well is to have some sort of substitution method, where you could pop something like [student] to have the students name pop out in that spot, or [observer] for the parent's name. Then you could write sentences like "Dear [observer], I'm writing to inform you that [student] achieved an excellent grade in ..."
Perhaps I can have a look at doing something like this in the coming holidays
Thanks for the quick reply!
That substitution method is exactly what I had in mind...but I have no idea how to make it work with the code.
I voted up the idea already posted and I sure hope Canvas incorporates it SOON!
In the meantime, teachers will keep using your script as is and I'll cross my fingers you get some time to beat Canvas over the holidays
Have a great weekend!
Not sure if this is still in development and I realize that this isn't a support thread, but I'm running into an issue trying to add this to my account theme.
I'm getting this error. Not sure if anyone can help point me in the right direction about what I'm missing.
Hi Matt,
Do you have existing JavaScript customisations you were combining this with?
Perhaps in your test instance (school.test.instructure.com), try adding only the msgobs.user.js file to your your JavaScript Customisations in your theme (from Admin > Themes > Current Theme Theme Editor > Upload, set Javascript File field to the msgobs.user.js file downloaded from the links above > Save theme > Apply). If that's successful, it might indicate an issue when combining with other scripts.
Figure it out. It was an issue with the server. Everything is working now.
New version 0.07 available here: https://github.com/sdjrice/msgobs
- Fixed issue where conversations (Inbox) recipients would become invalid after a recipient was removed.
Hi @Steve_25,
This had been working great until this week or so and we are now getting errors relating to the AutoCompleteView,js when we try to run it for a student. Below is the callstack.
MessageFormDialog.js:436 Uncaught TypeError: e.id.match is not a function
at ft.canAddNotesFor (MessageFormDialog.js:436)
at MessageFormDialog.js:410
at Function.lt (lodash.underscore.js:2481)
at ft.recipientIdsChanged (MessageFormDialog.js:409)
at c (backbone.js:208)
at Ue.trigger (backbone.js:149)
at Ue._addToken (AutocompleteView.js:719)
at AutocompleteView.js:829
at Function.rt (lodash.underscore.js:2273)
at Ue.setTokens (AutocompleteView.js:827)
I am running the code as part of the theme and have no other external JS than yours running.
Is this something you have seen before? It seems to load one parent but doesn't colour code them like it used to and dies trying to load a subsequent parent.
Kind Regards,
Courtney O'Sullivan
New version 0.08 available here: https://github.com/sdjrice/msgobs
- Fixed a conversations (Inbox) issue for instances with the faculty journal enabled.
@courtney_osulliApologies I missed your earlier post, I think I was unsubscribed from this thread after the community platform change. This version should fix the problem you reported.
Steve, I'm new to adding JavaScript to our Canvas installation. I have downloaded TamperMonkey and updated our information in the script. I'm a bit confused, though, by the Theme side of things and getting it uploaded into Canvas -- working with our test installation. Are you open to questions?
Hi @paula_setserkis, I'm certainly open to questions!
Regarding the installation of the script, if you do not have administrative access to Canvas for your institution, then the Tampermonkey method is for you, but if you are an administrator wanting to deploy the script for every teacher in your institution then the theme modification is where you should install the script. Only one of the two methods is required.
Good Morning,
I'm asking my IT dept to add this custom script to our Canvas instance. He's a little nervous doing so. Would anyone be willing to share any issues or problems you've had with the installation and use over time? Another specific question he had is: As Canvas updates its product, does the script break requiring you to adjust/recode/reload, etc.? Any information you could provide would be helpful!
All good questions sbevier.
Looking back over the conversations of this thread should give a fairly accurate idea of the problems faced and their frequency. Between 2017 and 2020 there have been very few updates required. When Instructure updates Canvas, some small changes have been necessary, which for each change require your IT department to replace the script with a new version, but instances of this occurring have been few. Instructure kindly keeps most elements stable.
The best way to check it out is to apply it to your test instance (yoursubdomain.test.instructure.com) and see what you think!
Hi Steve_25,
I just added the javascript to our Canvas Theme. It worked great in the grade book. Since you wrote that script, Canvas has added the ability to message students through New Analytics. This allows teachers to message students who have between certain percentages. Is there any way to add the observer buttons there too? Our district would benefit greatly from being able to message parents there as well as on individual assignments in the grade book. Thank you for your consideration. Let me know if you need additional clarification.
Thank you for your awesome script!
@lgibson3 Hey thanks for letting me know about that - I haven't looked at new analytics. I'm feeling optimistic about getting the script active there too, but I'll get back to you once I've done a bit of investigation.
Thank you so much! Having the ability to message observers of students who didn't turn in an assignment is a great step in the right direction. We have stopped using our Student Information System, so teachers can no longer send a progress report quickly to parents. Being able to add the "Send to Observers" button to the New Analytics message that allows teachers to send messages to students who. have a % between __ and __ would be amazing. Thank you for your willingness to work on this!
Laura Gibson
Hello Steve! I'm new here, and not sure if this matters, but I looked through your tool and found something I think could slow it down significantly. The msgobs.common.getEnrolmentsRecursively function would be a little faster if is was iterative, instead of recursive. I'm sure this is an unwelcome nitpick, and I'm not even sure if it is still used, as I did little more than skim it.
You're not wrong @_-TheTiredDev-_ ! In this case I'm deliberately wanting the script to proceed slowly to avoid triggering Canvas's API throttling, which would come about by hitting the API for every course enrolment, for every course that a user is enrolled in for a list of users. It is not a great solution to a niche scenario where Canvas admins add single users to a recipient list.
I've now re-written my script for up to ES2020 with proper code comments and support for New Analytics! I expect release this in February if you'd like to cast your eyes over a better version soon 🙂
This is amazing news, @Steve_25 !!!! Thank you so much for taking the time to look at New Analytics. I will be looking for ES2020!
Hello @Steve_25. Thank you for providing this script.
So I have installed the file in our instance and I am able to add observers and remove parents but I can't seem to get the send message to highlight so I can actually click Send. It is greyed out.
I am sure this is user error. But curious if you have seen that.
Thank you for your time to respond back to me/
Don
Hi @dlourcey, I think in this case it's not user error!
Are you seeing this problem when replying to a group conversation on the Inbox? If so, I have a fix in the works that handles this slightly awkward condition that occurs (when the user has admin privileges or previously was an admin) with a little more finesse. If you can hold on just a little longer I'd like to share that with you very soon!
If it's not a reply message creating the issue, I might need to get a bit more information from you. Feel free to send me a direct message.
To participate in the Instructure Community, you need to sign up or log in:
Sign In
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.