Skip to content

Document Teams SDK reply modes and reorganize messaging docs - #14764

Draft
Corina (corinagum) wants to merge 14 commits into
MicrosoftDocs:mainfrom
corinagum:cg/reply-mode-learn-docs
Draft

Corina (corinagum) wants to merge 14 commits into
MicrosoftDocs:mainfrom
corinagum:cg/reply-mode-learn-docs

Conversation

@corinagum

@corinagum Corina (corinagum) commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Documents reply modes in Teams SDK 2.3.0, where ctx.reply starts a thread under a top-level chat message by default, reorganizes the conversation and messaging pages so send, reply, threads and quotes are easier to follow, and fixes SDK samples and claims on those pages that were incorrect.

Note

This PR builds on #14762 (per-call service URLs in TypeScript) and includes its commits. Review only the commits after 810931df6. Once #14762 merges, this PR will contain only those commits. Reply modes ship in Teams SDK 2.3.0, which isn't released yet, so this PR shouldn't merge before that release.

Why

In Teams SDK 2.3.0, the context-level reply method (ctx.reply() / context.ReplyAsync()) follows the recommended agent behavior on the threads page: in a chat, a reply to a top-level message starts a thread under it. The reply mode controls this: combined (default, thread plus quote), thread (thread, no quote) and quote (stays at the level of the incoming message, which matches earlier versions). Several Learn pages described the earlier behavior, including an IMPORTANT note telling developers to call the app-level reply method from inside a handler to reach a thread. That workaround is no longer needed, and reactive replies are the preferred path.

Changes by page

Threads in channels and one-on-one agent chats (agent-chat-threads.md)

  • Reorganized the page around the common case. A new Reply in a thread section near the top shows the context-level reply in each language. The sections that follow are, in order: Choose where a message goes, Choose a reply mode, How context-level replies are placed, Identify and track discussions, and Reply in a thread later (the app-level example, previously titled "Reply in a thread"). They are H2s so they appear in "In this article".
  • Removed the IMPORTANT note that said context-level replies stay at the top level. In 2.3.0 they follow the recommended behavior.
  • Updated the placement tables in all three pivots: the reply row now says it starts a thread under a top-level message and quotes the user's message.
  • Choose a reply mode: a version note (2.3.0, preview APIs; earlier versions behave like the quote mode), app-wide and per-call snippets for C#, TypeScript and Python, one shared mode table, and a note that replies without thread IDs (for example in meetings) keep the quote in every mode.
  • How context-level replies are placed: the IDs threading needs, where a thread starts for reactions, edits, deletes and card actions, that a rejected thread reply throws without falling back, the channel 404 fallback, typing indicator placement (2.3.0), and a tip about replying and then sending.
  • Reply in a thread later: the examples previously called the app-level reply inside the message handler, a stop-gap until context replies could thread. They now store the destination (chat ID, root message ID, service URL and agentic identity) in the handler, reply with the context-level method, and call the app-level reply when a long task finishes. The per-call service URL guidance from [Doc Feature] Support per-call service URLs in Teams SDK TypeScript #14762 is kept and uses the stored values.
  • Behavior wording says "in a chat", because the SDK places replies by the IDs on the incoming activity. The title and availability sentence still say "one-on-one agent chats", since that describes what the service supports in preview.
  • Replaced the L1 and L2 terms with "top-level" and "in-thread".
  • C# samples use teams for the app object, matching the rest of Learn and the SDK's var teams = app.UseTeams() setup.

Send and receive messages (build-conversational-capability.md)

  • Reorganized into H2 sections in task order: Receive messages, Send messages, Quoted replies, Message content, Respond to message events (read receipt, edit, undelete, soft delete), Update and delete messages sent from agent, then the reference sections. Previously "Send a message" sat between the edit and undelete sections.
  • Send messages explains send versus reply with a link to the reply modes, and replaces Bot Framework wording ("turn context object").
  • Receive messages says that in group chats and channels an agent receives only @mentions by default, and links to the receive-all page, replacing a C#-only filter section that implied agents receive every message.
  • Quoted replies opens with a method table per language, so the explanation is written once. It documents the 2.3.0 rules: replies quote only activities that can be quoted, a reaction reply quotes the reacted-to message, a reply to a targeted message carries a prompt preview instead of a quote, and the reply mode decides the quote.
  • Read receipts: the C# tabs are now in the C# pivot (they showed on every language), the requirements are grouped together, TypeScript and Python samples are added, and the C# sample uses OnEvent (OnReadReceipt doesn't exist).
  • Added Python samples for edit, undelete and soft delete, and corrected the TypeScript route names (editMessage, undeleteMessage, softDeleteMessage).
  • Moved C#-only sentences into the C# pivot, and replaced Bot Framework reference links and self-redirecting "SDK reference" links.

Send proactive messages (send-proactive-messages.md)

  • Moved Samples under Send the message, next to the step it illustrates, and made "Understand who blocked, muted, or uninstalled an agent" its own section.
  • Language-neutral wording for the app-level send method, and removed the claim that the SDK creates the conversation (not true in Python), pointing to Create the conversation instead.
  • Added the context-level versus app-level reply contrast, and removed Bot Framework wording (conversationParameters, the Activity.ServiceUrl reference link).
  • The C# sample stores and passes the service URL, and its variables are in scope.

Other pages

  • bot-concepts.md: explains ctx.send versus ctx.reply with a link to the reply modes.
  • agent-plans.md: replaced L1 and L2 with "top-level" and "in-thread", and named the app-level reply method in the completion guidance.
  • receiving-sending-messages.md: removed repeated agentic identity guidance, and the proactive samples pass the stored service URL in all three languages.
  • sdk-code-basics.md and manage-conversation-state.md: the samples use send in all three languages, so the pivots behave the same in a chat.
  • channel-and-group-conversations.md, targeted-messages.md: small wording, link and naming fixes.

Corrected SDK samples and claims

A review of every SDK sample and claim on the touched pages against the TypeScript, Python and .NET SDK source found errors that predate this PR. Fixed:

  • C#: message update and delete samples now use UpdateActivityAsync / DeleteActivityAsync (the previous calls didn't compile), quote builder samples match their comments, mention samples use TeamsChannelAccount and MentionEntity, and bot-concepts.md names Context<TActivity>, TeamsBotApplication and OnAdaptiveCardAction.
  • TypeScript: member events use the conversationUpdate route (membersAdded and membersRemoved aren't routes), undeclared send and Recipient casing are fixed, and mention objects include the required role.
  • Python: the saved plan rebuild no longer raises KeyError, from_property is from_, snippets that didn't parse are fixed, and the tag mention sets type="tag".
  • Removed the claim that channelData isn't included in personal conversations.

Not changed

  • Streaming placement and limits on streaming-ux.md.
  • Tabs versus zone pivots on the proactive pages.

Validation

  • Learn build validation passes on every commit; PoliCheck reports no issues.
  • markdownlint with the repo config: no new findings.
  • Relative links and anchors in the changed files resolve; zone pivots are balanced in all changed files except a pre-existing imbalance in channel-and-group-conversations.md.
  • Reply mode APIs and every new or changed sample checked against the TypeScript, Python and .NET SDK source. Changed C# snippets compile against Microsoft.Teams.Apps, and changed Python snippets parse.

Alex Acebo (aacebo) and others added 4 commits November 23, 2026 11:18
Documents the Teams SDK 2.3.0 reply modes, where the context-level reply starts a thread under a top-level message in one-on-one chats by default, and reorganizes the conversation and messaging pages: placement tables and reply mode sections on the threads page, reply examples that send from stored values after a long task instead of calling the app-level reply inside a handler, a single-source quoted replies section, top-level and in-thread terms instead of L1 and L2, and corrected samples and links.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

…in Python

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@aroy-ms Arup Roy (aroy-ms) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the C# doc changes against the code in microsoft/teams.net#734 (head 24192d8). Python and TypeScript are out of scope for this pass. Inline comments below.

reviewed by Github Copilot with Claude Opus 5.5


Github Copilot on behalf of Arup

::: zone pivot="teams-sdk-csharp"
When your agent calls the reply method, the SDK automatically stamps a quoted reply entity referencing the inbound activity. The reply appears as a quoted reply in Teams.

The reply quotes the inbound activity only when that activity can be quoted, so a reply to a card action or another invoke is sent without a quote. A reply to a reaction quotes the message the user reacted to. Starting in Teams SDK 2.3.0, in a one-on-one chat, the reply also starts a thread under a top-level message by default. The [reply mode](how-to/conversations/agent-chat-threads.md#choose-a-reply-mode) decides whether the quote is added: the thread mode leaves it out, except on a reply that can't be threaded.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C#: a reply to a reaction is not quoted. "A reply to a reaction quotes the message the user reacted to" doesn't match teams.net#734. ReplyAsync quotes the inbound Activity.Id and only when it is a plain number (Context.cs L222-233). A messageReaction activity's id is a service id such as f:… (that's how the tests model it, L1864-1867), so in C# a reply to a reaction goes out without a quote. It is still threaded under the reacted message in a chat.

Suggest dropping that sentence, or replacing it with: "A reply to a reaction isn't quoted, but in a chat it starts a thread under the message the user reacted to."

reviewed by Github Copilot with Claude Opus 5.5


Github Copilot on behalf of Arup

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript has the same issue. reply() decides whether to quote based on the inbound activity's own id, and quotes that id, not replyToId (activity.ts L627-L632). A messageReaction has a service f: ID, so the reply isn't quoted. The microsoft/teams.ts#996 tests model reactions that way and assert only placement. The suggested rewrite works for TypeScript too. To quote the reacted-to message explicitly, use quote(activity.replyToId, ...).

reviewed by Github Copilot with Claude Opus 5.5


Github Copilot on behalf of Arup

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The live service doesn't send that shape. In our captures from Teams (1:1 and group chats, with the TypeScript, Python and .NET SDKs), every messageReaction arrives with a plain numeric id equal to the id of the message that was reacted to. So ReplyAsync / reply() quotes the reacted-to message through activity.id, and the reply rendered with that quote in all three SDKs. The f: id in the unit tests is a fixture choice to exercise the replyToId placement path, not the service's shape. I'll keep the sentence as is but clean up the unit tests to be more clear.


A reply that starts a thread starts it under the message the incoming activity is about: the user's message, or the message the user reacted to, edited, deleted, or selected a card button on. If that message can't be a thread root, for example a card message whose ID can't be used as a thread root, the reply stays at the top level. For how the SDK decides whether an activity is in a thread, see [Identify the incoming activity's level](#identify-the-incoming-activitys-level).

When the service rejects a thread reply in a one-on-one chat, the context-level reply method throws the error to your handler and doesn't send the reply at the top level instead. In a channel, if the service returns `404` for the thread reply, the SDK posts to the same thread through the legacy channel threading endpoint.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript: a default ctx.reply to a targeted top-level message might fail. When the inbound message is targeted and top-level in a chat that carries the threading IDs, ctx.reply targets the response and starts a thread under the user's targeted message: /replyChains/{replyChain.id}?isTargetedActivity=true (activity.ts L726-L759, activity-sender.ts L89-L93). microsoft/teams.ts#996 has a unit test for this path. This page's error table says a rootMessageId that identifies a targeted message returns 400 Replies are not allowed for Targeted Messages, and targeted-messages.md says targeted messages don't support replies. Because a rejected chat thread reply throws without a top-level fallback, the response would be lost, where 2.2 sent it at the top level.

Could you confirm the service behavior? If the 400 applies, document it here and in targeted-messages.md (for example, use replyMode: 'quote' or send for targeted prompts), or the SDK should skip threading for targeted inbound messages.

reviewed by Github Copilot with Claude Opus 5.5


Github Copilot on behalf of Arup

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested live in a group chat: a user's targeted message arrives with recipient.isTargeted: true and without channelData.replyChain, so none of the SDKs takes the thread path. The default ctx.reply went to POST /v3/conversations/{id}/activities?isTargetedActivity=true and returned 201, posting a private reply at the top level, the same as 2.2. No replyChains request was made, so the 400 Replies are not allowed for Targeted Messages case doesn't come up.

The unit test in [microsoft/teams.ts#996](microsoft/teams.ts#996) uses a targeted payload that also carries replyChain, a shape we haven't seen from the service. If Teams starts sending it, skipping threading for targeted inbound messages would be the fix.

agenticIdentity: getAgenticIdentity(activity.recipient),
};
await ctx.reply('Working on your trip plan.');
startTripPlanning(destination);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript: the sample doesn't compile as written. startTripPlanning isn't declared (TS2304). replyWhenDone is declared but never called, so the sample doesn't show how the stored destination reaches the completion reply. Suggest declaring the placeholder, for example declare function startTripPlanning(destination: ThreadDestination): void;, with a comment that the task calls replyWhenDone(destination) when it finishes. Alternatively, inline a minimal task that calls it.

reviewed by Github Copilot with Claude Opus 5.5


Github Copilot on behalf of Arup

@corinagum Corina (corinagum) Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally for code snippets we don't concern ourselves with defining example-oriented methods like startTripPlanning that's intended for showcasing a scenario; here I've just gone ahead and added placeholder definitions & resolved these, but going forward I'm not sure how much value this adds.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Corina (corinagum) and others added 4 commits November 24, 2026 11:52
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…usings

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 3ff56f3:

⚠️ Validation status: warnings

File Status Preview URL Details
msteams-platform/bots/build-conversational-capability.md ⚠️Warning View Details
msteams-platform/agents-in-teams/integrate-ai/agent-plans.md ✅Succeeded View
msteams-platform/agents-in-teams/manage-conversation-state.md ✅Succeeded View
msteams-platform/agents-in-teams/targeted-messages.md ✅Succeeded View
msteams-platform/botbuilder-migration/proactive-activities.md ✅Succeeded View
msteams-platform/bots/bot-concepts.md ✅Succeeded View
msteams-platform/bots/how-to/conversations/agent-chat-threads.md ✅Succeeded View
msteams-platform/bots/how-to/conversations/channel-and-group-conversations.md ✅Succeeded View
msteams-platform/bots/how-to/conversations/send-proactive-messages.md ✅Succeeded View
msteams-platform/concepts/agentic-identity/receiving-sending-messages.md ✅Succeeded View
msteams-platform/concepts/sdk-code-basics.md ✅Succeeded View

msteams-platform/bots/build-conversational-capability.md

  • Line 20, Column 232: [Warning: bookmark-not-found - See documentation] Cannot find bookmark '#filter-mention-messages' in 'agents-in-teams/enable-receive-all-chat-messages.md'.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm doing some refactoring that's going to foul this up, I am removing this file and putting its contents elsewhere. Don't invest any more here. When you're finished, let me know and I'll help get things reorganized.

On this topic, I would love your help in the future with activity events, I'm trying to reshape this content around a canonical reference for all of the events, their names, syntax, etc. What we have today is very incomplete.

Corina (corinagum) and others added 2 commits November 25, 2026 11:23
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…thread

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit c5677f9:

❌ Validation status: errors

Please follow instructions here which may help to resolve issue.

File Status Preview URL Details
❌Error Details

  • [Error: CannotMergeCommit] Cannot merge commit c5677f971334651a4a95adef36309e1af4f22e8f in branch cg/reply-mode-learn-docs of repository https://github.com/corinagum/msteams-docs into branch main (commit ddeb88996d0fef1ff3a1891085419a52c892df66). Please follow this documentation: https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ to use git.exe to resolve you content conflicts locally and then push to remote.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants