Currently, we are trying to use the live event webhooks to send notifications to users of our app. When an event occurs Canvas hits our API, the API parses out the needed info (like user_id) and makes a request to an internal API that sends a push notification to our app users.
We are testing this out first with the Grades events since the user_id is included in the body, making it easier to send to the user it pertains to.
While testing I noticed that a course_grade_change event will have the user_id set as expected like so:
{
user_id: '90',
course_id: '70',
workflow_state: 'active',
created_at: '2020-09-22T20:12:57Z',
updated_at: '2021-04-14T15:39:44Z',
current_score: 96.67,
old_current_score: 93.33,
final_score: 31.52,
old_final_score: 30.43,
unposted_current_score: 96.67,
old_unposted_current_score: 93.33,
unposted_final_score: 31.52,
old_unposted_final_score: 30.43
}
but the grade_change event seems to prefix all ids, including the user_id, with a random number like so:
{
submission_id: '111910000000000846',
assignment_id: '111910000000000083',
assignment_name: '.NET',
grade: '143',
old_grade: '145',
score: { numberStr: '143.0' },
old_score: { numberStr: '145.0' },
points_possible: { numberStr: '150.0' },
old_points_possible: { numberStr: '150.0' },
grader_id: '111910000000000066',
student_id: '111910000000000090',
user_id: '111910000000000090',
grading_complete: true,
muted: false
}
So I guess this brings about two questions. Is this expected? If so how should I go about determining what the prefix is in order to get all the correct ids? I could assume that I just need to parse out the numbers in the end after all the zeros but that seems fragile.