Forum Discussion
The bot is not a part of the conversation roster error in new chat(Chat->New)
Hi,
I am using Microsoft Bot Framework to create the message extension. I would like to get the user email of the customer who enters the search query in the bottom search chatbox. The email is getting correctly if we open the extension from the Teams->Chat but if we create a new chat from Chat->New Chat the email id is not getting. The following error is getting
[onTurnError] unhandled error: Error: The bot is not part of the conversation roster.
(node:21770) UnhandledPromiseRejectionWarning: Error: BotFrameworkAdapter.processActivity(): 500 ERROR
Error: The bot is not part of the conversation roster.
These are the code to get the email id
export default class MessageExtension extends TeamsActivityHandler {
async handleTeamsMessagingExtensionQuery(context, query) {
let searchQuery = query.parameters && query.parameters[0].name === 'query'
? query.parameters[0].value
: '';
const member = await this.getTeamMember(context);
console.log("email="+member);}}
async getSingleMember(context) {
try {
const member = await TeamsInfo.getMember(
context,
context.activity.from.id
);
var email = member.email;
const message = MessageFactory.text(`You are: ${member.email}`);
return email
} catch (e) {
if (e.code === 'MemberNotFoundInConversation') {
return context.sendActivity(MessageFactory.text('Member not found.'));
} else {
throw e;
}
}}
What may be the reason? Is it not possible to use TeamsInfo.getMember() to get the mail id for Teams->Chat?
Screenshot - Bottom search
- Prasad_Das-MSFTMicrosoft
fabin10
Could you please share the manifest file?- _r4m_Copper Contributor
I've the same issue, even using botframework-connector lib:
const credentials = new MicrosoftAppCredentials(process.env.BotId, process.env.BotPassword); const token = await credentials.getToken(); const client = new ConnectorClient(credentials, { baseUri: context.activity.serviceUrl }); MicrosoftAppCredentials.trustServiceUrl(context.activity.serviceUrl); let singleMemberDetailsResponse = await client.conversations.getConversationMembers(context.activity.conversation.id);
the response is a 403 bot is not part of the conversation roster.
Adding the bot to the conversation seems possible via action commands, popping-up the user with a request to add the bot. But in the case of search commands, it is not clear if this is feasible.
- fabin10Brass Contributor
Hi,
This is the manifest.json file
{ "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json", "manifestVersion": "1.9", "version": "1.0.1", "id": "<ID>", "packageName": "<packageName>", "developer": { "name": "chatapp", "websiteUrl": "", "privacyUrl": "", "termsOfUseUrl": "" }, "icons": { "color": "color.png", "outline": "outline.png" }, "name": { "short": "Chatapp", "full": "" }, "description": { "short": "This is a sample chat app", "full": "This is a sample chat app." }, "accentColor": "#FFFFFF", "configurableTabs": [ { "configurationUrl": "<URL>", "canUpdateConfiguration": false, "scopes": [ "team" ], "context": [ "channelTab" ] } ], "staticTabs": [ { "entityId": "id", "name": "Website", "contentUrl": "<URL>", "scopes": [ "personal" ] }, { "entityId": "conversations", "scopes": [ "personal" ] }, { "entityId": "about", "scopes": [ "personal" ] } ], "bots": [ { "botId": "<BOTID>", "scopes": [ "personal", "team" ], "supportsFiles": false, "isNotificationOnly": false } ], "composeExtensions": [ { "botId": "<BOTID>", "canUpdateConfiguration": true, "commands": [ { "id": "search", "type": "query", "title": "search", "description": "", "initialRun": false, "fetchTask": false, "context": [ "commandBox", "compose" ], "parameters": [ { "name": "query", "title": "Search Text", "description": "Search Text", "inputType": "text" } ] } ] } ], "permissions": [ "identity", "messageTeamMembers" ], "validDomains": [ "" ] }
- Prasad_Das-MSFTMicrosoft
fabin10
The bot MUST be installed to the Team in order to get the roster for that Team. If the bot is not installed in the Team, you will get a "The bot is not part of the conversation roster" error.
TeamsInfo.getMember() will not get the mail id from Chat->New Chat.