Thanks for reaching out.
When you create a subscription in order to get resource data (rich notification), You will get the resource data in the field called encryptedContent.
In order to get the resource id, which in your case is message Id. You need to read resource field as well from the notification object.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".