It sounds like the 500 error here is being caused by the user not being a board member, as you described on your post. We do have mutations for adding / deleting users as subscribers to the board:
You should be able to use these to add users to the board when needed through the API. Likewise, we have a query which will return the user IDs for subscribers to a board:
query{boards(ids: _______) {
id, subscribers {
id
}
}}
This being said, the logic for comparing the two user ID’s would have to be implemented on your side.