I am trying to call graph API from the Search messaging extension. When executing the following code, it throws an error Error: BotFrameworkAdapter.processActivity(): 500 ERROR. see attachment
Create a search messaging extension app using generator-teams@4.0.1
Create Azure bot and configure auth connection to access Graph API
Add the following code within the query method to authenticate the user
const adapter: any = context.adapter;
const magicCode = (query.state && Number.isInteger(Number(query.state))) ? query.state : '';
const tokenResponse = await adapter.getUserToken(context, this.connectionName, magicCode);
if (!tokenResponse || !tokenResponse.token) {
// There is no token, so the user has not signed in yet.
// Retrieve the OAuth Sign in Link to use in the MessagingExtensionResult Suggested Actions
const signInLink = await adapter.getSignInLink(context, this.connectionName);
let composeExtension: MessagingExtensionResult = {
type: 'config',
suggestedActions: {
actions: [{
title: 'Sign in as user',
value: signInLink,
type: ActionTypes.OpenUrl
}]
}
};
return Promise.resolve(composeExtension);
}
Expected results
In case, If the user has not logged in, it should display a login adaptive card to the user
Description
I am trying to call graph API from the Search messaging extension. When executing the following code, it throws an error Error: BotFrameworkAdapter.processActivity(): 500 ERROR. see attachment
Steps to reproduce
Expected results
In case, If the user has not logged in, it should display a login adaptive card to the user
Actual results
I am getting the following error
Project you experience issues with
generator-teams
generator version
4.
build tools version
4.0.1
nodejs version
v14.15.0
npm version
6.14.8
Operating system (environment)
Windows
Additional Info
No response