Language

TeamsBotApplication.ReplyAsync Method

Definition

Overloads

Name Description
ReplyAsync(String, String, TeamsActivityInput, Uri, AgenticIdentity, CancellationToken)

Sends an activity proactively as a reply in a reply chain (thread). Posts to the reply chain (thread) of the message messageId, in the chat or channel conversationId. When the activity carries a recipient marked as targeted (IsTargeted), it is sent as a targeted message visible only to that recipient.

ReplyAsync(String, String, String, Uri, AgenticIdentity, CancellationToken)

Sends a text message proactively as a reply in a reply chain (thread). Posts to the reply chain (thread) of the message messageId, in the chat or channel conversationId.

ReplyAsync(String, String, TeamsActivityInput, Uri, AgenticIdentity, CancellationToken)

Sends an activity proactively as a reply in a reply chain (thread). Posts to the reply chain (thread) of the message messageId, in the chat or channel conversationId. When the activity carries a recipient marked as targeted (IsTargeted), it is sent as a targeted message visible only to that recipient.

public System.Threading.Tasks.Task<Microsoft.Teams.Core.SendActivityResponse?> ReplyAsync(string conversationId, string messageId, Microsoft.Teams.Apps.Schema.TeamsActivityInput activity, Uri? serviceUrl = default, Microsoft.Teams.Core.Schema.AgenticIdentity? agenticIdentity = default, System.Threading.CancellationToken cancellationToken = default);
member this.ReplyAsync : string * string * Microsoft.Teams.Apps.Schema.TeamsActivityInput * Uri * Microsoft.Teams.Core.Schema.AgenticIdentity * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Teams.Core.SendActivityResponse>
Public Function ReplyAsync (conversationId As String, messageId As String, activity As TeamsActivityInput, Optional serviceUrl As Uri = Nothing, Optional agenticIdentity As AgenticIdentity = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SendActivityResponse)

Parameters

conversationId
String

The id of the chat or channel: channelData.chat.id or channelData.channel.id, not conversation.id.

messageId
String

The id of the message at the root of the reply chain: channelData.replyChain.id.

activity
TeamsActivityInput

The activity to send.

serviceUrl
Uri

The service URL. If null, uses the last-seen service URL from an incoming activity.

agenticIdentity
AgenticIdentity

The agentic identity for user-delegated token acquisition. Extract from the inbound activity's Recipient via GetAgenticIdentity().

cancellationToken
CancellationToken

A cancellation token.

Returns

The response from the send operation.

Exceptions

Thrown if conversationId or messageId is null, empty or whitespace.

Remarks

There is no fallback to another route, so every error from the service propagates, including HTTP 404 and 400. The SDK does not state where a client shows the message in a group chat.

Applies to

ReplyAsync(String, String, String, Uri, AgenticIdentity, CancellationToken)

Sends a text message proactively as a reply in a reply chain (thread). Posts to the reply chain (thread) of the message messageId, in the chat or channel conversationId.

public System.Threading.Tasks.Task<Microsoft.Teams.Core.SendActivityResponse?> ReplyAsync(string conversationId, string messageId, string text, Uri? serviceUrl = default, Microsoft.Teams.Core.Schema.AgenticIdentity? agenticIdentity = default, System.Threading.CancellationToken cancellationToken = default);
member this.ReplyAsync : string * string * string * Uri * Microsoft.Teams.Core.Schema.AgenticIdentity * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Teams.Core.SendActivityResponse>
Public Function ReplyAsync (conversationId As String, messageId As String, text As String, Optional serviceUrl As Uri = Nothing, Optional agenticIdentity As AgenticIdentity = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SendActivityResponse)

Parameters

conversationId
String

The id of the chat or channel: channelData.chat.id or channelData.channel.id, not conversation.id.

messageId
String

The id of the message at the root of the reply chain: channelData.replyChain.id.

text
String

The text to send.

serviceUrl
Uri

The service URL. If null, uses the last-seen service URL from an incoming activity.

agenticIdentity
AgenticIdentity

The agentic identity for user-delegated token acquisition. Extract from the inbound activity's Recipient via GetAgenticIdentity().

cancellationToken
CancellationToken

A cancellation token.

Returns

The response from the send operation.

Exceptions

Thrown if conversationId or messageId is null, empty or whitespace.

Remarks

There is no fallback to another route, so every error from the service propagates, including HTTP 404 and 400. The SDK does not state where a client shows the message in a group chat.

Applies to