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
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.