Hi @Piyumi Perera ,
The above error code tells that the above user is invalid or doesn't exist. Check whether the user exists in portal.office.com
If the user exists, using this endpoint
GET https://graph.microsoft.com/v1.0/users, you can query all the users in your tenant. In the response, The response contains
userPrincipalName that can be used to request the
/messages endpoint. Have you tried using other users on this issue?
You can refer to this documentation to get a token.
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".