Microsoft Teams channel plugin for OpenClaw that sends and receives messages as a real M365 user account — not a bot.
User identity | Delegated auth | Graph API | Webhook subscriptions | Open source
- Real user identity — Messages appear as your M365 user, not a bot
- Delegated auth — Device-code flow with persistent token cache (~90 day refresh)
- Inbound webhooks — Receives Teams notifications via Graph API subscriptions
- Auto-renewal — Subscriptions auto-renew every 50 minutes (60-min expiry)
- Session routing —
person:<email>for 1:1 chats,group:<chatId>for groups - DM policies — Supports
open,allowlist, andpairingmodes - Markdown chunking — Long messages split at 4000-char boundaries
openclaw plugins install @knowall-ai/openclaw-msteamsAdd to your openclaw.json:
{
"channels": {
"msteams-user": {
"enabled": true,
"clientId": "your-azure-app-client-id",
"tenantId": "your-azure-tenant-id",
"userId": "user-object-id",
"webhook": {
"port": 3978,
"url": "https://your-public-domain.com",
"clientState": "your-shared-secret"
},
"dmPolicy": "allowlist",
"allowFrom": ["colleague@example.com"]
}
}
}openclaw channels login msteams-userVisit the URL shown, enter the code, sign in with the M365 account. Done — tokens auto-renew for ~90 days.
openclaw channels status msteams-user
# Microsoft Teams (User) default: enabled, configured, running, worksMS Graph Webhooks ──▶ Plugin Monitor (:3978) ──▶ OpenClaw Gateway
│ │
│ validates clientState │ processes message
│ enriches sender info │ routes to session
│ fetches conversation │
▼ ▼
/hooks/wake Agent replies via
Graph API outbound
│
▼
Teams Chat
(as real M365 user)
| Requirement | Details |
|---|---|
| OpenClaw | Running instance |
| Node.js | 18+ |
| Azure AD App | With delegated Graph API permissions |
| Public HTTPS | For Graph webhook notifications |
Chat.ReadWrite— Read and send chat messagesChatMessage.Send— Send messages in chatsChannelMessage.Send— Send messages in channelsUser.Read— Read authenticated user profileChat.Read— Read chat metadataUser.ReadBasic.All— Read basic profile of other users
├── index.ts # Plugin entry point
├── openclaw.plugin.json # Plugin manifest
├── package.json # Package config
├── src/
│ ├── auth.ts # MSAL delegated auth (device-code flow)
│ ├── channel.ts # ChannelPlugin definition (all adapters)
│ ├── inbound.ts # Notification processing + session routing
│ ├── monitor.ts # Express webhook server
│ ├── outbound.ts # ChannelOutboundAdapter
│ ├── runtime.ts # Plugin runtime getter/setter
│ ├── send.ts # Graph API message sending
│ ├── subscriptions.ts # Graph webhook subscription lifecycle
│ ├── token.ts # Credential resolution from config
│ └── types.ts # Shared TypeScript types
└── docs/
├── SOLUTION_DESIGN.adoc # Architecture and design
├── DEPLOYMENT.adoc # Installation and configuration
├── TESTING.adoc # Testing guide
├── TROUBLESHOOTING.adoc # Common issues and fixes
├── generate-docs.sh # PDF generator script
└── themes/
└── knowall-theme.yml # PDF theme
| Document | Description |
|---|---|
| Solution Design | Architecture, data flow, design decisions |
| Deployment | Installation, configuration, reverse proxy |
| Testing | Manual testing checklist, verification |
| Troubleshooting | Common issues and their fixes |
| This Plugin | Official Plugin | |
|---|---|---|
| Identity | Real M365 user | Bot identity |
| Auth | Delegated (device-code) | Bot Framework (app credentials) |
| API | Microsoft Graph | Bot Framework SDK |
| Messages | Appear as the user | Appear as a bot |
| Setup | Azure AD app + login | Bot registration + channels |
git clone https://github.com/knowall-ai/openclaw-msteams.git
cd openclaw-msteams
npm install
openclaw plugins install --link ./index.tsMIT
Built by KnowAll AI