mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
3c4e07973c
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chat-adapter/teams
Microsoft Teams adapter for the chat SDK.
Installation
npm install chat @chat-adapter/teams
Usage
import { Chat } from "chat";
import { createTeamsAdapter } from "@chat-adapter/teams";
const chat = new Chat({
userName: "mybot",
adapters: {
teams: createTeamsAdapter({
appId: process.env.TEAMS_APP_ID!,
appPassword: process.env.TEAMS_APP_PASSWORD!,
}),
},
});
// Handle @mentions
chat.onNewMention(async (thread, message) => {
await thread.post("Hello from Teams!");
});
Configuration
| Option | Required | Description |
|---|---|---|
appId |
Yes | Azure Bot App ID |
appPassword |
Yes | Azure Bot App Password |
tenantId |
No | Azure AD Tenant ID (for single-tenant apps) |
Setup
1. Create Azure Bot
- Go to Azure Portal
- Create a new Azure Bot resource
- Note the App ID and create an App Password
2. Configure Bot Messaging Endpoint
Set the messaging endpoint to your webhook URL:
https://your-domain.com/api/webhooks/teams
3. Create Teams App
- Go to Teams Developer Portal
- Create a new app
- Configure bot with your Azure Bot App ID
- Install the app to your Teams workspace
Features
- Message posting and editing
- Thread subscriptions
- Reaction events (receive only)
- File attachments
- Rich cards (Adaptive Cards)
- Action callbacks (card actions)
- Typing indicators
- Direct messages
- Proactive messaging
Limitations
- Adding reactions: Teams Bot Framework doesn't support bots adding reactions
- Message history: No API to fetch message history
License
MIT