Skip to content
Guides

OpenClaw Microsoft Teams message behaviour

Session keys for DMs, channels and groups, the Posts versus Threads reply-style problem and the resolution precedence, thread context preservation for live and proactive sends, outbound mention syntax, attachments with and without Graph, and sending files into group chats through SharePoint

6 min read

Teams looks like one channel and behaves like two: classic Posts channels thread replies under a card, Threads-style channels flow linearly, and the API never tells a bot which one it is in. OpenClaw's reply style setting exists for that, and the file rules exist because channel attachments live in SharePoint rather than in the message. Here are the sessions, the reply style with its precedence, thread preservation, mentions, attachments and group-chat files.

Sessions and reply style

  • Session keys follow the standard agent format: direct messages share the main session by default, and channel and group messages use the conversation ID under a channel or group key.
  • Teams has two channel UI styles over the same data model, classic Posts with cards and threaded replies underneath, which wants the thread reply style, the default, and Slack-like Threads with linear flow, which wants top-level; the API does not expose which style a channel uses, so thread in a Threads channel nests replies awkwardly and top-level in a Posts channel scatters replies as separate posts.
  • The fix is to configure the reply style per channel under the teams map, and the resolution runs from the most specific override down: per-channel, per-team, global, then an implicit default derived from the mention requirement, thread when a mention is required and top-level when it is not; turning the mention requirement off globally without an explicit reply style makes mentions in Posts channels surface as top-level posts even for thread replies, so the docs say to pin the thread style at some level.
  • Proactive sends into a stored channel conversation, such as queued tool-call replies and long-running agents, resolve the same way, while group chats and personal conversations always resolve to top-level for proactive sends regardless of the setting.
The problem: the Teams API does not expose which UI style a channel uses.

Thread preservation, mentions, attachments

When the thread style is in effect and the bot was mentioned from inside a channel thread, OpenClaw re-attaches the original thread root to the outbound conversation reference so the reply lands in the same thread, for live sends and for proactive sends made after the Bot Framework turn context has expired; the root comes from the stored thread ID on the conversation reference, and older references that predate it fall back to the last inbound activity ID so existing deployments keep working. Under the top-level style, channel-thread inbounds are answered as new top-level posts by design, and top-level posts where you expected threads mean the style is wrong for that channel. Outbound mentions use the name-in-brackets-and-ID markup with a Teams user or bot ID or an Entra object ID, brackets inside the display name escaped with backslashes and a doubled backslash for a literal one, and the same formatting applies to edits and file captions. Attachments have limits: in DMs images and files work through the Teams bot file APIs, while in channels and groups attachments live in SharePoint or OneDrive and the webhook payload carries only an HTML stub, so Graph permissions are required to download them and without them channel images arrive as text only; the upload-file action sends a file first with an optional message as the comment and a filename override, OpenClaw downloads media only from Microsoft and Teams hostnames unless the media host allowlist is widened, and Authorization headers are attached only for hosts in the media auth allowlist, which should stay strict.

Files in group chats

  • Bots send files in DMs through the built-in file consent card flow, which works out of the box, images in any context go inline as base64, and files in group chats or channels need extra setup because bots use an application identity and Graph's me resource requires a signed-in user, so the bot uploads to a SharePoint site and creates a sharing link.
  • The setup adds the sites read-write application permission to upload and the chat member read-all permission as the least-privileged tenant-wide grant for group-chat sends, with chat read-all also covering it and the per-chat resource-specific chat-member permission as an alternative, grants admin consent, fetches the site ID from Graph for the site's hostname and path, and stores it in the SharePoint site ID key.
  • A channel with the sites permission gets an organisation-wide sharing link, a group chat with a supported chat-member grant gets a per-user link only chat members can open, and a group chat without one fails closed, because OpenClaw requires a successful member lookup and treats timeouts, transport failures, empty results and Graph denials as failures rather than widening access; the fallback table repeats that a missing site or member permission yields an actionable configuration error, personal chats use the consent card without SharePoint, and uploaded files land in a shared OpenClaw folder in the site's default document library.

OpenClaw on Microsoft Teams is the channel post this behaviour belongs to, and OpenClaw Microsoft Teams configuration the keys the reply style and file settings live under.

Why the style has to be pinned

A bot that cannot see which UI a channel uses has to be told, and the mention-derived default is a reasonable guess that breaks exactly when you switch mentions off for a busy channel. OpenClaw Microsoft Teams manifest and permissions covers the Graph permissions that turn HTML stubs back into files, and OpenClaw Slack threads and sessions the threading model on Slack, where the API does say which surface a message came from.

On Diali

Microsoft Teams is not among the channels Diali connects today: WhatsApp, Telegram, Discord, Slack, Mattermost, Matrix, SMS and voice. Hosted OpenClaw on Diali is the assistant and Diali security describes the boundary that applies to each connected channel.

  • Posts channels want thread; Threads channels want top-level.
  • Channel attachments are HTML stubs without Graph.
  • Group-chat files go through SharePoint and fail closed without member reads.
Get started

Stop reading about it, build one

Set up an agent, pick a channel, and have it working inside the app you already keep open.