Showing results for 
Show  only  | Search instead for 
Did you mean: 
Community Contributor

Setting Default User Notification Preferences via API

The default notification settings are different than our recommended settings for our parents.  We would like to automatically set those preferences any time we create a new user.  It looks like we can do this using the Notification Preferences API calls.  I'm curious whether anyone currently uses the API to set user notification preferences and whether masquerading is required (as implied in this thread:​).

I'll take any lessons learned or suggestions any one may have.


Labels (1)
11 Replies
Community Champion

I don't have the information you seek.  We are looking for assistance with the same issue.  I hope someone has this in their toolbox.

I'd like to echo  @dwillmore ‌'s statement. It's been on my radar as a thing to look into as well. Please keep us posted on how this goes. 


I'm going to share this to the Canvas Admins space and see if it gets any more attention from that crowd.

 @bniessen , can you add anything here? I noticed you seemed to have had some success in the other thread.

New Member


We had a similar problem but I do not know if our solution will work for you. It works for us because every night we synchronize Canvas with our Student Information Services (SIS) and it is this synchronization that creates new users. This means that we already had a set up where we could add one more script to be run nightly and that this script is run minutes after new users are created. Other users are updated manually but their preference are not set to our 'defaults' until the next day.

In a database we have the id of the last user (last_user_id_updated) whose preferences have already been updated by the script. The script then:

  1. Lists all the users [GET /api/v1/accounts/:account_id/users] and for each of them with id higher than last_user_id_updated.
  2. Finds the user's communication_channel [GET users/:user_id/communication_channels]. 
  3. Updates the preferences by category [PUT users/self/communication_channels/:comm_channel/notification_preference_categories/:category]
  4. Updates last_user_id_updated in our database.

It is necessary to masquerade as the user to make the changes in the preferences however with the API this is not that difficult. If you have an access token that belongs to a user with the necessary permissions then all that is necessary is add the parameter as_user_id to your request. Masquerading - Canvas LMS REST API Documentation 

What a great way to handle this.  I did not think of handling this using the Masquerading API.   This is very helpful.  Do you differentiate between student and faculty?

What SIS system are you using?  We are running Datatel.

We do not differentiate between students and faculty. If I am correcty that would be a bit difficult because it would be necessary to check all the enrollments of a user to know if they are enrolled as "teacher" in any course.

The SIS that we use is very particular to Norway it is called FS. A brief presentation of FS - Common Student System 


Thank you very much for the information and quick reply.  We use the user email address as our user ID and students are in a different domain than faculty so I think we will be able to differentiate users for this process.  

Again, thank you so much,


Glad I could help. Good luck!

New Member

Hey  @derak_kilgo ‌, 

Anything to add here? Looks like Ana may have already answered the questions, but just in case.


Nope. Ana nailed it. You have to masquerade as the user to do this action.

You can try this out using your test site.

Let say my student's id is 142 and their email address is communication channel 110.
I want to disable "assignment_due_date_changed" notifications for this user.

curl -k  -L -X PUT -H 'Content-Type: application/json' -H 'Authorization: Bearer 9999~your-api-key-here' ''

This will fail with a HTTP 422 - Client Error  / Unprocessable Entity

Change that request to "self" and add a parameter "as_user_id=142".

curl -k  -L -X PUT -H 'Content-Type: application/json' -H 'Authorization: Bearer 9999~your-api-key-here' '[frequency]=never'

And the request will succeed.
Student 142's "assignment_due_date_changed" preference has been changed to "never".