Caricamento in corso...
Caricamento in corso...
Last synced: Today, 22:00
Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
Status: text + DM attachments are supported; channel/group file sending requires
sharePointSiteIdupload-fileMicrosoft Teams ships as a bundled plugin in current OpenClaw releases, so no separate install is required in the normal packaged build.
If you are on an older build or a custom install that excludes bundled Teams, install a current npm package when one is published:
bashopenclaw plugins install @openclaw/msteams
If npm reports the OpenClaw-owned package as deprecated, use a current packaged OpenClaw build or the local checkout path until a newer npm package is published.
Local checkout (when running from a git repo):
bashopenclaw plugins install ./path/to/local/msteams-plugin
Details: Plugins
The @microsoft/teams.cli
1. Install and log in
bashnpm install -g @microsoft/teams.cli@preview teams login teams status # verify you're logged in and see your tenant info
2. Start a tunnel (Teams can't reach localhost)
Install and authenticate the devtunnel CLI if you haven't already (getting started guide).
bash# One-time setup (persistent URL across sessions): devtunnel create my-openclaw-bot --allow-anonymous devtunnel port create my-openclaw-bot -p 3978 --protocol auto # Each dev session: devtunnel host my-openclaw-bot # Your endpoint: https://<tunnel-id>.devtunnels.ms/api/messages
Alternatives:
ngrok http 3978tailscale funnel 39783. Create the app
bashteams app create \ --name "OpenClaw" \ --endpoint "https://<your-tunnel-url>/api/messages"
This single command:
The output will show
CLIENT_IDCLIENT_SECRETTENANT_ID4. Configure OpenClaw using the credentials from the output:
json5{ channels: { msteams: { enabled: true, appId: "<CLIENT_ID>", appPassword: "<CLIENT_SECRET>", tenantId: "<TENANT_ID>", webhook: { port: 3978, path: "/api/messages" }, }, }, }
Or use environment variables directly:
MSTEAMS_APP_IDMSTEAMS_APP_PASSWORDMSTEAMS_TENANT_ID5. Install the app in Teams
teams app createbashteams app get <teamsAppId> --install-link
6. Verify everything works
bashteams app doctor <teamsAppId>
This runs diagnostics across bot registration, AAD app config, manifest validity, and SSO setup.
For production deployments, consider using federated authentication (certificate or managed identity) instead of client secrets.
By default, Microsoft Teams is allowed to write config updates triggered by
/config set|unsetcommands.config: trueDisable with:
json5{ channels: { msteams: { configWrites: false } }, }
DM access
channels.msteams.dmPolicy = "pairing"channels.msteams.allowFromchannels.msteams.dangerouslyAllowNameMatching: trueGroup access
channels.msteams.groupPolicy = "allowlist"groupAllowFromchannels.defaults.groupPolicychannels.msteams.groupAllowFromchannels.msteams.allowFromgroupPolicy: "open"channels.msteams.groupPolicy: "disabled"Example:
json5{ channels: { msteams: { groupPolicy: "allowlist", groupAllowFrom: ["user@org.com"], }, }, }
Teams + channel allowlist
channels.msteams.teamsgroupPolicy="allowlist"Team/Channelchannels.msteams.dangerouslyAllowNameMatching: trueExample:
json5{ channels: { msteams: { groupPolicy: "allowlist", teams: { "My Team": { channels: { General: { requireMention: true }, }, }, }, }, }, }
If you can't use the Teams CLI, you can set up the bot manually through the Azure Portal.
msteams~/.openclaw/openclaw.json/api/messagesGo to Create Azure Bot
Fill in the Basics tab:
| Field | Value |
|---|---|
| Bot handle | Your bot name, e.g., text openclaw-msteams |
| Subscription | Select your Azure subscription |
| Resource group | Create new or use existing |
| Pricing tier | Free for dev/testing |
| Type of App | Single Tenant (recommended - see note below) |
| Creation type | Create new Microsoft App ID |
appIdappPasswordtenantIdhttps://your-domain.com/api/messagesbotbotId = <App ID>personalteamgroupChatsupportsFiles: trueoutline.pngcolor.pngmanifest.jsonoutline.pngcolor.pngjson5{ channels: { msteams: { enabled: true, appId: "<APP_ID>", appPassword: "<APP_PASSWORD>", tenantId: "<TENANT_ID>", webhook: { port: 3978, path: "/api/messages" }, }, }, }
Environment variables:
MSTEAMS_APP_IDMSTEAMS_APP_PASSWORDMSTEAMS_TENANT_IDThe Teams channel starts automatically when the plugin is available and
msteamsAdded in 2026.4.11
For production deployments, OpenClaw supports federated authentication as a more secure alternative to client secrets. Two methods are available:
Use a PEM certificate registered with your Entra ID app registration.
Setup:
Config:
json5{ channels: { msteams: { enabled: true, appId: "<APP_ID>", tenantId: "<TENANT_ID>", authType: "federated", certificatePath: "/path/to/cert.pem", webhook: { port: 3978, path: "/api/messages" }, }, }, }
Env vars:
MSTEAMS_AUTH_TYPE=federatedMSTEAMS_CERTIFICATE_PATH=/path/to/cert.pemUse Azure Managed Identity for passwordless authentication. This is ideal for deployments on Azure infrastructure (AKS, App Service, Azure VMs) where a managed identity is available.
How it works:
@azure/identity169.254.169.254Prerequisites:
169.254.169.254:80Config (system-assigned managed identity):
json5{ channels: { msteams: { enabled: true, appId: "<APP_ID>", tenantId: "<TENANT_ID>", authType: "federated", useManagedIdentity: true, webhook: { port: 3978, path: "/api/messages" }, }, }, }
Config (user-assigned managed identity):
json5{ channels: { msteams: { enabled: true, appId: "<APP_ID>", tenantId: "<TENANT_ID>", authType: "federated", useManagedIdentity: true, managedIdentityClientId: "<MI_CLIENT_ID>", webhook: { port: 3978, path: "/api/messages" }, }, }, }
Env vars:
MSTEAMS_AUTH_TYPE=federatedMSTEAMS_USE_MANAGED_IDENTITY=trueMSTEAMS_MANAGED_IDENTITY_CLIENT_ID=<client-id>For AKS deployments using workload identity:
Enable workload identity on your AKS cluster.
Create a federated identity credential on the Entra ID app registration:
bashaz ad app federated-credential create --id <APP_OBJECT_ID> --parameters '{ "name": "my-bot-workload-identity", "issuer": "<AKS_OIDC_ISSUER_URL>", "subject": "system:serviceaccount:<NAMESPACE>:<SERVICE_ACCOUNT>", "audiences": ["api://AzureADTokenExchange"] }'
Annotate the Kubernetes service account with the app client ID:
yamlapiVersion: v1 kind: ServiceAccount metadata: name: my-bot-sa annotations: azure.workload.identity/client-id: "<APP_CLIENT_ID>"
Label the pod for workload identity injection:
yamlmetadata: labels: azure.workload.identity/use: "true"
Ensure network access to IMDS (
169.254.169.254169.254.169.254/32| Method | Config | Pros | Cons |
|---|---|---|---|
| Client secret | text appPassword | Simple setup | Secret rotation required, less secure |
| Certificate | text authType: "federated"text certificatePath | No shared secret over network | Certificate management overhead |
| Managed Identity | text authType: "federated"text useManagedIdentity | Passwordless, no secrets to manage | Azure infrastructure required |
Default behavior: When
authTypeTeams can't reach
localhostbash# One-time setup: devtunnel create my-openclaw-bot --allow-anonymous devtunnel port create my-openclaw-bot -p 3978 --protocol auto # Each dev session: devtunnel host my-openclaw-bot
Alternatives:
ngrok http 3978tailscale funnel 3978If your tunnel URL changes, update the endpoint:
bashteams app update <teamsAppId> --endpoint "https://<new-url>/api/messages"
Run diagnostics:
bashteams app doctor <teamsAppId>
Checks bot registration, AAD app, manifest, and SSO configuration in one pass.
Send a test message:
teams app get <id> --install-linkAll config keys can be set via environment variables instead:
MSTEAMS_APP_IDMSTEAMS_APP_PASSWORDMSTEAMS_TENANT_IDMSTEAMS_AUTH_TYPE"secret""federated"MSTEAMS_CERTIFICATE_PATHMSTEAMS_CERTIFICATE_THUMBPRINTMSTEAMS_USE_MANAGED_IDENTITYMSTEAMS_MANAGED_IDENTITY_CLIENT_IDOpenClaw exposes a Graph-backed
member-infoRequirements:
Member.Read.GroupUser.Read.AllThe action is gated by
channels.msteams.actions.memberInfochannels.msteams.historyLimitmessages.groupChat.historyLimit0allowFromgroupAllowFromReplyTo*channels.msteams.dmHistoryLimitchannels.msteams.dms["<user_id>"].historyLimitThese are the existing resourceSpecific permissions in our Teams app manifest. They only apply inside the team/chat where the app is installed.
For channels (team scope):
ChannelMessage.Read.GroupChannelMessage.Send.GroupMember.Read.GroupOwner.Read.GroupChannelSettings.Read.GroupTeamMember.Read.GroupTeamSettings.Read.GroupFor group chats:
ChatMessage.Read.ChatTo add RSC permissions via the Teams CLI:
bashteams app rsc add <teamsAppId> ChannelMessage.Read.Group --type Application
Minimal, valid example with the required fields. Replace IDs and URLs.
json5{ $schema: "https://developer.microsoft.com/en-us/json-schemas/teams/v1.23/MicrosoftTeams.schema.json", manifestVersion: "1.23", version: "1.0.0", id: "00000000-0000-0000-0000-000000000000", name: { short: "OpenClaw" }, developer: { name: "Your Org", websiteUrl: "https://example.com", privacyUrl: "https://example.com/privacy", termsOfUseUrl: "https://example.com/terms", }, description: { short: "OpenClaw in Teams", full: "OpenClaw in Teams" }, icons: { outline: "outline.png", color: "color.png" }, accentColor: "#5B6DEF", bots: [ { botId: "11111111-1111-1111-1111-111111111111", scopes: ["personal", "team", "groupChat"], isNotificationOnly: false, supportsCalling: false, supportsVideo: false, supportsFiles: true, }, ], webApplicationInfo: { id: "11111111-1111-1111-1111-111111111111", }, authorization: { permissions: { resourceSpecific: [ { name: "ChannelMessage.Read.Group", type: "Application" }, { name: "ChannelMessage.Send.Group", type: "Application" }, { name: "Member.Read.Group", type: "Application" }, { name: "Owner.Read.Group", type: "Application" }, { name: "ChannelSettings.Read.Group", type: "Application" }, { name: "TeamMember.Read.Group", type: "Application" }, { name: "TeamSettings.Read.Group", type: "Application" }, { name: "ChatMessage.Read.Chat", type: "Application" }, ], }, }, }
bots[].botIdwebApplicationInfo.idbots[].scopespersonalteamgroupChatbots[].supportsFiles: trueauthorization.permissions.resourceSpecificTo update an already-installed Teams app (e.g., to add RSC permissions):
bash# Download, edit, and re-upload the manifest teams app manifest download <teamsAppId> manifest.json # Edit manifest.json locally... teams app manifest upload manifest.json <teamsAppId> # Version is auto-bumped if content changed
After updating, reinstall the app in each team for new permissions to take effect, and fully quit and relaunch Teams (not just close the window) to clear cached app metadata.
manifest.jsonversion1.0.01.1.0manifest.jsonoutline.pngcolor.pngWorks:
Does NOT work:
Adds:
| Capability | RSC Permissions | Graph API |
|---|---|---|
| Real-time messages | Yes (via webhook) | No (polling only) |
| Historical messages | No | Yes (can query history) |
| Setup complexity | App manifest only | Requires admin consent + token flow |
| Works offline | No (must be running) | Yes (query anytime) |
Bottom line: RSC is for real-time listening; Graph API is for historical access. For catching up on missed messages while offline, you need Graph API with
ChannelMessage.Read.AllIf you need images/files in channels or want to fetch message history, you must enable Microsoft Graph permissions and grant admin consent.
ChannelMessage.Read.AllChat.Read.AllChatMessage.Read.AllAdditional permission for user mentions: User @mentions work out of the box for users in the conversation. However, if you want to dynamically search and mention users who are not in the current conversation, add
User.Read.AllTeams delivers messages via HTTP webhook. If processing takes too long (e.g., slow LLM responses), you may see:
OpenClaw handles this by returning quickly and sending replies proactively, but very slow responses may still cause issues.
Teams markdown is more limited than Slack or Discord:
codeKey settings (see
/gateway/configurationchannels.msteams.enabledchannels.msteams.appIdchannels.msteams.appPasswordchannels.msteams.tenantIdchannels.msteams.webhook.port3978channels.msteams.webhook.path/api/messageschannels.msteams.dmPolicypairing | allowlist | open | disabledchannels.msteams.allowFromchannels.msteams.dangerouslyAllowNameMatchingchannels.msteams.textChunkLimitchannels.msteams.chunkModelengthnewlinechannels.msteams.mediaAllowHostschannels.msteams.mediaAuthAllowHostschannels.msteams.requireMentionchannels.msteams.replyStylethread | top-levelchannels.msteams.teams.<teamId>.replyStylechannels.msteams.teams.<teamId>.requireMentionchannels.msteams.teams.<teamId>.toolsallowdenyalsoAllowchannels.msteams.teams.<teamId>.toolsBySender"*"channels.msteams.teams.<teamId>.channels.<conversationId>.replyStylechannels.msteams.teams.<teamId>.channels.<conversationId>.requireMentionchannels.msteams.teams.<teamId>.channels.<conversationId>.toolsallowdenyalsoAllowchannels.msteams.teams.<teamId>.channels.<conversationId>.toolsBySender"*"toolsBySenderid:e164:username:name:id:channels.msteams.actions.memberInfochannels.msteams.authType"secret""federated"channels.msteams.certificatePathchannels.msteams.certificateThumbprintchannels.msteams.useManagedIdentitychannels.msteams.managedIdentityClientIdchannels.msteams.sharePointSiteIdagent:<agentId>:<mainKey>agent:<agentId>:msteams:channel:<conversationId>agent:<agentId>:msteams:group:<conversationId>Teams recently introduced two channel UI styles over the same underlying data model:
| Style | Description | Recommended text replyStyle |
|---|---|---|
| Posts (classic) | Messages appear as cards with threaded replies underneath | text thread |
| Threads (Slack-like) | Messages flow linearly, more like Slack | text top-level |
The problem: The Teams API does not expose which UI style a channel uses. If you use the wrong
replyStylethreadtop-levelSolution: Configure
replyStylejson5{ channels: { msteams: { replyStyle: "thread", teams: { "19:abc...@thread.tacv2": { channels: { "19:xyz...@thread.tacv2": { replyStyle: "top-level", }, }, }, }, }, }, }
Current limitations:
action=upload-filemediafilePathpathmessagefilenameWithout Graph permissions, channel messages with images will be received as text-only (the image content is not accessible to the bot). By default, OpenClaw only downloads media from Microsoft/Teams hostnames. Override with
channels.msteams.mediaAllowHosts["*"]channels.msteams.mediaAuthAllowHostsBots can send files in DMs using the FileConsentCard flow (built-in). However, sending files in group chats/channels requires additional setup:
| Context | How files are sent | Setup needed |
|---|---|---|
| DMs | FileConsentCard → user accepts → bot uploads | Works out of the box |
| Group chats/channels | Upload to SharePoint → share link | Requires text sharePointSiteId |
| Images (any context) | Base64-encoded inline | Works out of the box |
Bots don't have a personal OneDrive drive (the
/me/driveAdd Graph API permissions in Entra ID (Azure AD) → App Registration:
Sites.ReadWrite.AllChat.Read.AllGrant admin consent for the tenant.
Get your SharePoint site ID:
bash# Via Graph Explorer or curl with a valid token: curl -H "Authorization: Bearer $TOKEN" \ "https://graph.microsoft.com/v1.0/sites/{hostname}:/{site-path}" # Example: for a site at "contoso.sharepoint.com/sites/BotFiles" curl -H "Authorization: Bearer $TOKEN" \ "https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/BotFiles" # Response includes: "id": "contoso.sharepoint.com,guid1,guid2"
Configure OpenClaw:
json5{ channels: { msteams: { // ... other config ... sharePointSiteId: "contoso.sharepoint.com,guid1,guid2", }, }, }
| Permission | Sharing behavior |
|---|---|
text Sites.ReadWrite.All | Organization-wide sharing link (anyone in org can access) |
text Sites.ReadWrite.Alltext Chat.Read.All | Per-user sharing link (only chat members can access) |
Per-user sharing is more secure as only the chat participants can access the file. If
Chat.Read.All| Scenario | Result |
|---|---|
| Group chat + file + text sharePointSiteId | Upload to SharePoint, send sharing link |
| Group chat + file + no text sharePointSiteId | Attempt OneDrive upload (may fail), send text only |
| Personal chat + file | FileConsentCard flow (works without SharePoint) |
| Any context + image | Base64-encoded inline (works without SharePoint) |
Uploaded files are stored in a
/OpenClawShared/OpenClaw sends Teams polls as Adaptive Cards (there is no native Teams poll API).
openclaw message poll --channel msteams --target conversation:<id> ...~/.openclaw/msteams-polls.jsonSend semantic presentation payloads to Teams users or conversations using the
messageThe
presentationpresentationAgent tool:
json5{ action: "send", channel: "msteams", target: "user:<id>", presentation: { title: "Hello", blocks: [{ type: "text", text: "Hello!" }], }, }
CLI:
bashopenclaw message send --channel msteams \ --target "conversation:19:abc...@thread.tacv2" \ --presentation '{"title":"Hello","blocks":[{"type":"text","text":"Hello!"}]}'
For target format details, see Target formats below.
MSTeams targets use prefixes to distinguish between users and conversations:
| Target type | Format | Example |
|---|---|---|
| User (by ID) | text user:<aad-object-id> | text user:40a1a0ed-4ff2-4164-a219-55518990c197 |
| User (by name) | text user:<display-name> | text user:John Smith |
| Group/channel | text conversation:<conversation-id> | text conversation:19:abc123...@thread.tacv2 |
| Group/channel (raw) | text <conversation-id> | text 19:abc123...@thread.tacv2text @thread |
CLI examples:
bash# Send to a user by ID openclaw message send --channel msteams --target "user:40a1a0ed-..." --message "Hello" # Send to a user by display name (triggers Graph API lookup) openclaw message send --channel msteams --target "user:John Smith" --message "Hello" # Send to a group chat or channel openclaw message send --channel msteams --target "conversation:19:abc...@thread.tacv2" --message "Hello" # Send a presentation card to a conversation openclaw message send --channel msteams --target "conversation:19:abc...@thread.tacv2" \ --presentation '{"title":"Hello","blocks":[{"type":"text","text":"Hello"}]}'
Agent tool examples:
json5{ action: "send", channel: "msteams", target: "user:John Smith", message: "Hello!", }
json5{ action: "send", channel: "msteams", target: "conversation:19:abc...@thread.tacv2", presentation: { title: "Hello", blocks: [{ type: "text", text: "Hello" }], }, }
/gateway/configurationdmPolicyThe
groupIdTeam URL:
texthttps://teams.microsoft.com/l/team/19%3ABk4j...%40thread.tacv2/conversations?groupId=... └────────────────────────────┘ Team conversation ID (URL-decode this)
Channel URL:
texthttps://teams.microsoft.com/l/channel/19%3A15bc...%40thread.tacv2/ChannelName?groupId=... └─────────────────────────┘ Channel ID (URL-decode this)
For config:
/team/19:Bk4j...@thread.tacv2@thread.skype/channel/groupIdBots have limited support in private channels:
| Feature | Standard Channels | Private Channels |
|---|---|---|
| Bot installation | Yes | Limited |
| Real-time messages (webhook) | Yes | May not work |
| RSC permissions | Yes | May behave differently |
| @mentions | Yes | If bot is accessible |
| Graph API history | Yes | Yes (with permissions) |
Workarounds if private channels don't work:
ChannelMessage.Read.Allchannels.msteams.requireMention=falseoutline.pngcolor.pngwebApplicationInfo.idChannelMessage.Read.GroupChatMessage.Read.Chat© 2024 TaskFlow Mirror
Powered by TaskFlow Sync Engine