MS Teams Get Roster returns "The bot is not part of the conversation roster."

Viewed 8253

I am trying to fetch the MS Teams roaster / user profile. Below are the sequence of Postman calls I am making:

Generated Access Token: https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token

Generated User Access Token: https://login.microsoftonline.com/{{TenantId}}/oauth2/v2.0/token Get

My Joined Team: https://graph.microsoft.com/v1.0/me/joinedTeams

Get Internal Team Id:https://graph.microsoft.com/v1.0/teams/{{TeamId}}/channels

Fetch Roster/user profile:https://{{ServiceUrl}}/v3/conversations/{{tId}}/members/

Everything was working fine, but today I am getting 403 forbidden error

{
    "error": {
        "code": "BotNotInConversationRoster",
        "message": "The bot is not part of the conversation roster."
    }
}

Please note that I am able to communicate with the bot.

Below are the permissions that I have provided for delegate and application Directory.Read.All Group.Read.All Group.ReadWrite.All User.Read User.Read.All User.ReadBasic.All

Any suggestions to fix the same?

2 Answers

Notice that your last call, the one to "serviceurl", is NOT part of the Graph, obviously. As a result, it's authentication is different. In this case, Teams is authenticating it as a bot, and it needs certain rights. For instance, the bot MUST be installed to the Team in question in order to get the roster for that Team. You say it was working before - is that in the same Team? If not, the bot needs to be added to that Team. If "yes", then perhaps the bot was removed from the Team by someone?

Related