@microsoft/teams.apps
TypeScript icon, indicating that this package has built-in type declarations

2.0.13 • Public • Published

@microsoft/teams.apps

Build Microsoft Teams agents, tabs, message extensions, and proactive notification services in TypeScript.

@microsoft/teams.apps handles Teams activity routing, request auth, replies, proactive sends, Graph access, OAuth sign-in, plugins, and HTTP hosting so you can focus on your app behavior.

Read the full docs at aka.ms/teams-sdk-ts.

Install

npm install @microsoft/teams.apps

Hello Teams agent

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

const app = new App();

app.on('message', async ({ activity, reply }) => {
  await reply(`You said: ${activity.text}`);
});

app.start().catch(console.error);

By default, the app receives Teams activities at /api/messages.

Use your existing server

@microsoft/teams.apps can start its own HTTP server, or plug into an existing server/framework with an HTTP adapter.

import express from 'express';
import { App, ExpressAdapter } from '@microsoft/teams.apps';

async function main() {
  const server = express();

  server.get('/health', (_req, res) => {
    res.json({ status: 'ok' });
  });

  const app = new App({
    httpServerAdapter: new ExpressAdapter(server),
  });

  app.on('message', async ({ activity, reply }) => {
    await reply(`You said: ${activity.text}`);
  });

  await app.initialize(); // registers /api/messages on your server

  server.listen(process.env.PORT || 3978);
}

main().catch(console.error);

See the HTTP adapter examples for framework integration samples.

Examples

See the examples folder for agents, tabs, message extensions, proactive messaging, Graph, AI/MCP, A2A, and more.