Do you try to add members from the UI?
As we are mainly responsible for general issue of Microsoft Teams. Your question which is involved in development is not supported by us.
I saw the example 2 in this link, it only contains one user. Perhaps, it needs to specific the role of user2 as “member”.
To get better response, you can post this case in Microsoft Teams developer forum. You will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction. Thank you for your understanding.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.