The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
I'm trying to update notification preferences for an email communication channel using the API. There are some 90+ notification preferences, and the update command is working for all except for confirm_sms_communication_channel
The sample below succeeds in updating preferences for the fields used.
The code I'm using is C#
static async void updatePreferences(string sis_user_id, string channel_id)
{
string requestUri = $"api/v1/users/self/communication_channels/{channel_id}/notification_preferences?as_user_id=sis_user_id:{sis_user_id}";
FormUrlEncodedContent content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("notification_preferences[new_announcement][frequency]", "immediately"),
new KeyValuePair<string, string>("notification_preferences[assignment_due_date_changed][frequency]", "weekly"),
new KeyValuePair<string, string>("notification_preferences[confirm_email_communication_channel][frequency]", "immediately"), "immediately"),
});
HttpResponseMessage response = await client.PutAsync(
requestUri, content);
string message = await response.Content.ReadAsStringAsync();
Console.WriteLine(message);
if (response.IsSuccessStatusCode)
{Console.WriteLine("Success");}
else
{Console.WriteLine("Fail");}
}
The result of this function is a success:
It is also a success if I include the 90 or so other notification preferences.
However, if I include the confirm_sms_communication_channel as part of the key value pair it breaks the whole thing
new KeyValuePair<string, string>("notification_preferences[confirm_sms_communication_channel][frequency]", "immediately")When adding the above KeyValuePair the result is that "The specified resource does not exist."
I know for a fact that it should exist because when you get a full list of notification_preferences it is included in the response. Below is a fraction of that result.
{
"frequency": "immediately",
"notification": "confirm_email_communication_channel",
"category": "registration"
},
{
"frequency": "immediately",
"notification": "confirm_sms_communication_channel",
"category": "registration"
},I also tried updating the sms notification preference using the single call format, which works for any other notification type.
static async void updatePreference(string sis_user_id, string channel_id, string notification)
{
string requestUri = $"api/v1/users/self/communication_channels/{channel_id}/notification_preferences/confirm_sms_communication_channel?as_user_id=sis_user_id:{sis_user_id}";
FormUrlEncodedContent content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("notification_preferences[frequency]", "immediately")
});
HttpResponseMessage response = await client.PutAsync(
requestUri, content);
string message = await response.Content.ReadAsStringAsync();
Console.WriteLine(message);
//preferences = await response.Content.ReadAsAsync<List<NotificationPreference>>();
if (response.IsSuccessStatusCode)
{Console.WriteLine("Success");}
else
{Console.WriteLine("Fail");}
}But for confirm_sms_communication_channel i get the same result
and even tried categories, which works for other categories such as late_grading, but it fails for the registration category
string requestUri = $"api/v1/users/self/communication_channels/{channel_id}/notification_preference_categories/registration?as_user_id=sis_user_id:{sis_user_id}";
FormUrlEncodedContent content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("notification_preferences[frequency]", "immediately")
});
This is kind of baffling. Has anyone else run into this problem?
Hi Jeremy,
Where are you getting the channel Id from?
From your first example, it seems you may be trying to use the same channel id for SMS and email, but they’re different channels. Trying to update confirm_sms_communication_chanel for an email channel won’t work even though the sms address is constructed as an email address.
And that last bit is actually important: just a heads-up is you aren’t aware—Canvas doesn’t actually send SMS. They use different carriers’ email-to-SMS gateways, and those are notoriously unreliable. I’m a Verizon customer, and as such I’m supposed to be able to receive messages send to @vtext.com, but I’ve never successfully received a single message sent that by any person or service, from anyone, including Canvas. In fact, I’ve never even been able to confirm my mobile number with Canvas (unless I force it with the API) because even the confirmation message fails.
The behavior seems to be carrier specific, so YMMV, wildly.
Also be aware that for many carriers SMTP-to-SMS messages are not part of unlimited mobile-to-mobile SMS (actually MMS, for the most part) plans, and may incur costs.
--j
Ok, that does make sense. The channel in question would be an email channel that would have just been created through the api. Somehow I had rationalized that there would be a reason to use your email address to confirm that you wanted to add an sms notification, and so I thought that not having this preference set would cause a problem sometime in the future. But I guess any confirmation for sms would only go through the sms channel... This is why sleep is important.
So basically what you're saying is: a) Don't try to update the notification preference confirm_sms_communication_channel for an email channel because it doesn't exist, and b) Don't bother trying to implement sms notifications at all because they're unreliable. That second part is unfortunate though, because I know a lot of students would prefer text notifications.
Thank you for the feedback. That helps a lot.
-Jeremy
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in