Skip to main content

Activity Handlers

A BotBuilder ActivityHandler is similar to the activity routing of the Teams AI App. The BotBuilderPlugin accepts a botbuilder Activity Handler instance so you can keep using your existing activity handlers while migrating however many you want to new Teams AI handlers. This allows for a more incremental migration strategy.

info

this snippet shows how to use the BotBuilderPlugin to route activities using botbuilder alongside the default Teams AI activity routing.

import { App } from '@microsoft/teams.apps';
import { BotBuilderPlugin } from '@microsoft/teams.botbuilder';

import adapter from './adapter';
import handler from './activity-handler';

const app = new App({
plugins: [new BotBuilderPlugin({ adapter, handler })],
});

app.on('message', async ({ send }) => {
await send('hi from teams...');
});

(async () => {
await app.start();
})();
hi from botbuilder...
hi from teams...