Language

TeamsBotApplication.SendAsync Method

Definition

Overloads

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

Sends an activity proactively to a conversation. When the activity carries a recipient marked as targeted (IsTargeted), it is sent as a targeted message visible only to that recipient.

SendAsync(String, String, Uri, AgenticIdentity, CancellationToken)

Sends a text message proactively to a conversation.

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

Sends an activity proactively to a conversation. 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?> SendAsync(string conversationId, Microsoft.Teams.Apps.Schema.TeamsActivityInput activity, Uri? serviceUrl = default, Microsoft.Teams.Core.Schema.AgenticIdentity? agenticIdentity = default, System.Threading.CancellationToken cancellationToken = default);
member this.SendAsync : 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 SendAsync (conversationId 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 conversation ID to send to. For channel threads, include ;messageid=.

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.

Applies to

SendAsync(String, String, Uri, AgenticIdentity, CancellationToken)

Sends a text message proactively to a conversation.

public System.Threading.Tasks.Task<Microsoft.Teams.Core.SendActivityResponse?> SendAsync(string conversationId, string text, Uri? serviceUrl = default, Microsoft.Teams.Core.Schema.AgenticIdentity? agenticIdentity = default, System.Threading.CancellationToken cancellationToken = default);
member this.SendAsync : string * string * Uri * Microsoft.Teams.Core.Schema.AgenticIdentity * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Teams.Core.SendActivityResponse>
Public Function SendAsync (conversationId 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 conversation ID to send to. For channel threads, include ;messageid=.

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.

Applies to