Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Write a bot that responds to messages in Teams using the Teams SDK. Pick your language below.
:::tip If you haven't registered your Teams app yet, start with Quickstart: Register your app — you'll need the credentials before this code can talk to Teams. :::
Pick your language
If you scaffolded with teams project new typescript, your src/index.ts already looks like this:
import { App } from '@microsoft/teams.apps';
const app = new App();
app.on('message', async ({ send, activity }) => {
await send({ type: 'typing' });
await send(`you said "${activity.text}"`);
});
app.start(process.env.PORT || 3978).catch(console.error);
| Part | Purpose |
|---|---|
new App() |
Reads credentials from .env automatically |
app.on('message', ...) |
Registers a handler for incoming messages |
send({ type: 'typing' }) |
Shows the typing indicator while you build a reply |
send(...) |
Replies in the same conversation |
app.start(port) |
Starts the HTTP server on the given port |
Run it:
npm run dev
Continue with the TypeScript guide for events, sending messages, Adaptive Cards, AI, and more.
What's next
- Essentials — events, activities, sending messages, authentication: TypeScript · C# · Python
- In-depth guides — Adaptive Cards, AI, MCP, dialogs, tabs, and more: TypeScript · C# · Python
- Quickstart: Register your app — set up bot infrastructure with the Teams Developer CLI