The API Client
BotBuilder exposes a static class TeamsInfo
that allows you to query the api. In Teams AI
we pass an instance of our ApiClient
into all our activity handlers.
- Diff
- BotBuilder
- Teams AI
- import {
- CloudAdapter,
- ConfigurationBotFrameworkAuthentication,
- TeamsInfo,
- } from 'botbuilder';
+ import { App } from '@microsoft/teams.apps';
- const auth = new ConfigurationBotFrameworkAuthentication(process.env);
- const adapter = new CloudAdapter(auth);
+ const app = new App();
- export class ActivityHandler extends TeamsActivityHandler {
- constructor() {
- super();
- this.onMessage(async (context) => {
- const members = await TeamsInfo.getMembers(context);
- });
- }
- }
+ app.on('message', async ({ api, activity }) => {
+ const members = await api.conversations.members(activity.conversation.id).get();
+ });
import {
CloudAdapter,
ConfigurationBotFrameworkAuthentication,
TeamsInfo,
} from 'botbuilder';
const auth = new ConfigurationBotFrameworkAuthentication(process.env);
const adapter = new CloudAdapter(auth);
export class ActivityHandler extends TeamsActivityHandler {
constructor() {
super();
this.onMessage(async (context) => {
const members = await TeamsInfo.getMembers(context);
});
}
}
import { App } from '@microsoft/teams.apps';
const app = new App();
app.on('message', async ({ api, activity }) => {
const members = await api.conversations.members(activity.conversation.id).get();
});