Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,24 @@ In .NET, reaction APIs are marked with `[Experimental("ExperimentalTeamsReaction
</PropertyGroup>
```
:::

<!-- context-send-method-name -->

`Send()`

<!-- context-reply-method-name -->

`Reply()`

<!-- threading-reactive-example -->

```csharp
app.OnMessage(async context =>
{
// Send in the same thread, no quote
await context.Send("Acknowledged");

// Send in the same thread with a visual quote of the inbound message
await context.Reply("Got it!");
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,35 @@ public static async Task SendTargetedNotification(string conversationId, Account
.WithRecipient(recipient, isTargeted: true)
);
}
```

<!-- app-reply-method-name -->

`app.Reply()`

<!-- to-thread-id-method-name -->

`Conversation.ToThreadedConversationId()`

<!-- app-send-method-name -->

`app.Send()`

<!-- threading-proactive-example -->

```csharp
// Send to a specific thread proactively
await app.Reply(conversationId, messageId, "Thread update!");

// Send to a flat conversation (1:1, group chat)
await app.Reply(conversationId, "Hello!");
```

<!-- threading-helper-example -->

```csharp
using Microsoft.Teams.Api;

var threadId = Conversation.ToThreadedConversationId(conversationId, messageId);
await app.Send(threadId, "Sent via helper");
```
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,35 @@ async def send_targeted_notification(conversation_id: str, recipient: Account):
MessageActivityInput(text="This is a private notification just for you!")
.with_recipient(recipient, is_targeted=True)
)
```

<!-- app-reply-method-name -->

`app.reply()`

<!-- to-thread-id-method-name -->

`to_threaded_conversation_id()`

<!-- app-send-method-name -->

`app.send()`

<!-- threading-proactive-example -->

```python
# Send to a specific thread proactively
await app.reply(conversation_id, message_id, "Thread update!")

# Send to a flat conversation (1:1, group chat)
await app.reply(conversation_id, "Hello!")
```

<!-- threading-helper-example -->

```python
from microsoft_teams.apps import to_threaded_conversation_id

thread_id = to_threaded_conversation_id(conversation_id, message_id)
await app.send(thread_id, "Sent via helper")
```
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,35 @@ const sendTargetedNotification = async (conversationId: string, recipient: Accou
.withRecipient(recipient, true)
);
};
```

<!-- app-reply-method-name -->

`app.reply()`

<!-- to-thread-id-method-name -->

`toThreadedConversationId()`

<!-- app-send-method-name -->

`app.send()`

<!-- threading-proactive-example -->

```typescript
// Send to a specific thread proactively
await app.reply(conversationId, messageId, 'Thread update!');

// Send to a flat conversation (1:1, group chat)
await app.reply(conversationId, 'Hello!');
```

<!-- threading-helper-example -->

```typescript
import { toThreadedConversationId } from '@microsoft/teams.apps';

const threadId = toThreadedConversationId(conversationId, messageId);
await app.send(threadId, 'Sent via helper');
```
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,29 @@ async def handle_message(ctx: ActivityContext[MessageActivity]):
<!-- targeted-preview-note -->
N/A

<!-- reactions-preview-note -->
N/A

<!-- context-send-method-name -->

`send()`

<!-- context-reply-method-name -->

`reply()`

<!-- threading-reactive-example -->

```python
@app.on_message
async def handle_message(ctx: ActivityContext[MessageActivity]):
# Send in the same thread, no quote
await ctx.send("Acknowledged")

# Send in the same thread with a visual quote of the inbound message
await ctx.reply("Got it!")
```
N/A

<!-- reactions-preview-note -->
N/A
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,24 @@ app.on('message', async ({ send, activity }) => {
N/A

<!-- reactions-preview-note -->
N/A
N/A

<!-- context-send-method-name -->

`send()`

<!-- context-reply-method-name -->

`reply()`

<!-- threading-reactive-example -->

```typescript
app.on('message', async ({ send, reply }) => {
// Send in the same thread, no quote
await send('Acknowledged');

// Send in the same thread with a visual quote of the inbound message
await reply('Got it!');
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,15 @@ Reactions allow your agent to add or remove emoji reactions on messages in a con
### Reactions in preview

<LanguageInclude section="reactions-preview-note" />

## Threading

In Teams channels, messages can be organized into threads. A thread is identified by appending `;messageid={messageId}` to the conversation ID. The SDK provides helpers to simplify working with threads.

### Reactive Threading (Within a Handler)

When your agent receives a message in a thread, the conversation context already carries the thread ID. Use <LanguageInclude section="context-send-method-name" /> to send a message in the same thread without quoting, or <LanguageInclude section="context-reply-method-name" /> to send with a visual quote of the inbound message.

<LanguageInclude section="threading-reactive-example" />

For proactive threading (sending to a thread outside of a handler), see [Proactive Messaging](./proactive-messaging#proactive-threading).
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,19 @@ Targeted messages, also known as ephemeral messages, are delivered to a specific
When sending targeted messages proactively, you must explicitly specify the recipient account.

<LanguageInclude section="targeted-proactive-example" />

## Proactive Threading

To send a message to a thread outside of a handler, use <LanguageInclude section="app-reply-method-name" /> with the conversation ID and thread root message ID. The SDK constructs the threaded conversation ID for you.

<LanguageInclude section="threading-proactive-example" />

You can also pass just a conversation ID to <LanguageInclude section="app-reply-method-name" /> for flat contexts (1:1, group chat, meetings).

For reactive threading (within a handler), see [Threading](./#threading).

### Thread ID Helper

For advanced scenarios, the <LanguageInclude section="to-thread-id-method-name" /> helper constructs the threaded conversation ID directly. Use it with <LanguageInclude section="app-send-method-name" /> when you need full control. Note that <LanguageInclude section="to-thread-id-method-name" /> is only valid for conversations that support threading (channels and some 1:1 chats) — group chats and meetings do not support threading at this time.

<LanguageInclude section="threading-helper-example" />
Loading