We've been running the script firstname.lastname@example.org shared to include observers in a Canvas Inbox message. I have staff receiving an invalid recipient name error when they try to send a message where they've used this button, but it seems to be inconsistent:
So I'm stumped, any ideas? The course is published, so that's not the issue. Is it just some thing with this particular student or parent accounts (it's both the mother and father). The mother in this case is also a teacher (but with a separate Canvas account/SIS ID) so it's easy to test with her, I can't really start pushing out test messages to random parents.
Does this happen for all observers, or just some? I don't suppose there are special characters in the observers name? Might be a programming error on my part. I'll check it out.
I believe you can send test messages on your testing instance at <institusion subdomain>.test.instructure.com without them being actually sent.
We tried with one student and both parents. I tried removing one parent and then the other an had the same error. When I selected the observers without using the button the message sent without issue, and when I made myself an observer I was able to send the message, so it doesn't appear to be a special character. I'll do some testing in test to see what else I can find. Is there somewhere in the JS I can insert a log statement to see what's getting populated into the field?
Sorry for the delay (busy times!). The issue you're seeing reminded me of another problem that I hadn't got around to fixing. Now that I've cleared that up (latest version here), would you mind checking again to see if your issue persists?
I have just begun having the same issue. Through sometime last week, I was able to add observers outside of our LMS, now I am getting an "invalid error" when trying to add parents.
For the life of me I can't figure out what's triggering this.
So, it's gotta be something with the API, but what would be different about this parent/student combo? We enroll all our parents through SIS, so there wouldn't be any issues with accepting invitations, and there are no special characters in their user names or id fields. The parents' name are getting populated in the To field, the error only occurs once you hit send.
Thanks Jewell and Stephen, I've been completely swamped over here. Jewell, I ran your script in Beta and saw the table you mention in the console. Your script was working for me. Stephen, I updated our script with your new code and my teacher's are reporting that everything is working now. Thanks everyone!
Cool, glad to hear that's working.
email@example.com, one solution to this problem appears to be to use Instructure's own method for inserting recipients to the form, rather than manually creating DOM elements (as I did previously). The function setTokens() of AutocompleteView.js accepts Instructure user objects and neatly creates the appropriate DOM elements, plus whatever else is required to validate the form correctly. You can read Instructure's nicely formatted and commented code here.