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!
Hello,
I'm generating a group of users via a SIS upload then trying to go through each profile and switch off all notifications for each user. Currently I have a script that looks up the user's communication channel id and then tries to switch just the first notification preference to "never".
But on the second step, I'm hitting a 500 error and I'm not sure what I'm getting wrong. I'm sure it's something simple. Here's the segment of my code I'm having trouble with:
foreach($parent in $Parents){
$apiURL1 = $domain+"/api/v1/users/sis_user_id:"+$parent.user_id+"/communication_channels/"
$data1 = (Invoke-WebRequest -Headers $headers -Method GET -ContentType 'application/json' -Uri $apiURL1)
$userChannel = $data1.Content | ConvertFrom-Json
$channelAPI = $domain+"/api/v1/users/self/communication_channels/"+$userChannel.id+"/notification_preferences?as_user_id=sis_user_id:"+$parent.user_id
$BodyData = @{"notification_preferences[course_content][frequency]" = "never"; "notification_preferences[due_date][frequency]" = "never"}
$json = $BodyData | ConvertTo-Json
$data2 = (Invoke-WebRequest -Headers $headers -Method PUT -ContentType 'application/json' -Uri $channelAPI -Body $json)
}
Any ideas?
Thanks,
Rob
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