0

I'm working on a Teams app with 3 personal tabs and a messaging extension (a search command). I need to fetch the details of the user performing the search and here is how I'm doing it :

async handleTeamsMessagingExtensionQuery(context, query) {
      const { aadObjectId } = context.activity.from;
      const user = await TeamsInfo.getMember(context, aadObjectId); // Error: The bot is not part of the conversation roster
      ...
}

This is working only in the compose box in the "chat" tab with the bot but not in compose box in a group chat or a channel. In other scopes I'm getting The bot is not part of the conversation roster

I'm able to fetch the user details when the app is installed for the first time by implementing onTeamsMemberAdded(context) :

async onTeamsMembersAdded(context) {
  const { aadObjectId } = context.activity.from;
  const user = await TeamsInfo.getMember(context, aadObjectId);
  console.log("onTeamsMembersAdded " + JSON.stringify(user, null, 2));
}

I tried installing the app in both ways : sideload and publish to our organization catalogue

Here is the bot and composeExtension props of the manifest.json :

"bots": [
    {
        "botId": "5159b699-a8c3-4170-ae49-c22ccb76cdfr",
        "scopes": [
            "personal",
            "team",
            "groupchat"
        ],
        "supportsFiles": false,
        "isNotificationOnly": false
    }
],

...

"composeExtensions": [
    {
        "botId": "5159b699-a8c3-4170-ae49-c22ccb76cdfr",
        "canUpdateConfiguration": false,
        "commands": [
            {
                "id": "searchCmd",
                "type": "query",
                "title": "Search",
                "description": "",
                "initialRun": false,
                "fetchTask": false,
                "context": [
                    "commandBox",
                    "compose"
                ],
                "parameters": [
                    {
                        "name": "searchKeywords",
                        "title": "Search",
                        "description": "Search...",
                        "inputType": "text"
                    }
                ]
            }
        ]
    }
]

What am I doing wrong ?

botbuilder version : 4.14.1

manifest version : 1.9

jouhami
  • 419
  • 5
  • 12
  • https://stackoverflow.com/questions/60579906/ms-teams-get-roster-returns-the-bot-is-not-part-of-the-conversation-roster – ranusharao Sep 15 '21 at 22:43

1 Answers1

0

In order to make it work you have to first install bot in the group chat or channel. If you are directly accessing Messaging extension then it will not work.

To get the member of some group chat or channel, bot needs to be there to get these information if bot is not in chat how it can get that info? I hope I make sense.

Hunaid Hanfee-MSFT
  • 836
  • 1
  • 3
  • 8
  • Exactly that is what I was missing (I found out just after posting the question) But since my app has only one search command the icon of my app was already available in the command box after installing the personal tabs which is confusing. IMO I think the icon in the command box should not be available if the bot is not installed on the group chat or channel. How to check the list of installed bots in a channel or group chat ? – jouhami Sep 15 '21 at 09:03
  • 1
    In order to check if app is installed or not there is multiple way. One is to go and check from Teams Client by going into *Manage Teams -> Apps* -https://i.stack.imgur.com/RObwB.png. Other is to use Graph API - [Get installed apps](https://learn.microsoft.com/en-us/graph/api/resources/teamsappinstallation?view=graph-rest-1.0). – Hunaid Hanfee-MSFT Sep 15 '21 at 09:41
  • I know how to check for installed apps in a team but there is no indication that a bot is installed. For example I have an app with one configurable tab and a bot. I installed the app (configurable tab) in a channel. I can see this app in Manage Teams -> Apps but i cannot see if the bot is also installed or not. – jouhami Sep 17 '21 at 12:47
  • 1
    I will share if I find something that can tell if its bot or tab. – Hunaid Hanfee-MSFT Sep 20 '21 at 21:46