Language

TeamsBotApplication Class

Definition

Teams-specific bot application.

public class TeamsBotApplication : Microsoft.Teams.Core.BotApplication
type TeamsBotApplication = class
    inherit BotApplication
Public Class TeamsBotApplication
Inherits BotApplication
Inheritance
TeamsBotApplication

Constructors

Name Description
TeamsBotApplication(ApiClient, IHttpContextAccessor, ILogger<TeamsBotApplication>, TeamsBotApplicationOptions, TurnStateLoader, FileDownloader)

Initializes a new TeamsBotApplication.

TeamsBotApplication(ApiClient, IHttpContextAccessor, ILogger<TeamsBotApplication>, TeamsBotApplicationOptions, TurnStateLoader)

Initializes a new TeamsBotApplication without a file downloader.

Preserves the exact signature shipped in 2.1.0. C# bakes optional arguments into the CALLER, so an assembly compiled against 2.1.0 emits a call to this five-parameter form. Without it that call resolves to nothing at runtime and throws MissingMethodException, which recompiling the consuming app cannot fix when the offending IL is inside a third-party library built against the older version.

Hidden from IntelliSense because it is a compatibility shim rather than an API to choose. New code should use the constructor that accepts a file downloader.

Properties

Name Description
Api

Gets the hierarchical API facade for Teams operations.

AppId

Gets the application (client) ID configured for this bot (for example, the Azure AD app registration client ID).

(Inherited from BotApplication)
ConversationClient

Gets the ConversationClient used to send, update, and delete activities in conversations.

(Inherited from BotApplication)
OnActivity

Gets or sets the delegate that is invoked to handle each incoming activity.

(Inherited from BotApplication)
UserTokenClient

Gets the UserTokenClient used to manage OAuth user tokens (sign-in, sign-out, token exchange).

(Inherited from BotApplication)
Version

NuGet package version

Methods

Name Description
GetOAuthFlow(String)

Gets a registered OAuthFlow by connection name. Use this to attach callbacks (OnSignInComplete(SignInCompleteHandler), OnSignInFailure(SignInFailureHandler)) to flows that were configured via AddOAuthFlow(String, Action<OAuthOptions>).

HasMatchingRoute(CoreActivity)

Determines whether any registered route matches the given activity.

ProcessAsync(HttpContext, CancellationToken)

Processes an incoming HTTP request containing a bot activity.

(Inherited from BotApplication)
Reply(String, String, String, AgenticIdentity, CancellationToken)
Obsolete.

Sends a text message proactively as a threaded reply. Constructs a threaded conversation ID from the conversation ID and message ID.

Reply(String, String, TeamsActivity, AgenticIdentity, CancellationToken)
Obsolete.

Sends an activity proactively as a threaded reply. Constructs a threaded conversation ID from the conversation ID and message ID.

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

Sends a text message proactively as a threaded reply. Constructs a threaded conversation ID from the conversation ID and message ID.

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

Sends an activity proactively as a threaded reply. Constructs a threaded conversation ID from the conversation ID and message ID.

Send(String, String, Uri, AgenticIdentity, CancellationToken)
Obsolete.

Sends a text message proactively to a conversation.

Send(String, TeamsActivity, Uri, AgenticIdentity, CancellationToken)
Obsolete.

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.

SendActivityAsync(String, CoreActivityInput, Uri, AgenticIdentity, Boolean, CancellationToken)

Sends the specified activity to the conversation asynchronously.

(Inherited from BotApplication)
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.

UseMiddleware(ITurnMiddleware)

Adds the specified turn middleware to the middleware pipeline.

(Inherited from BotApplication)

Extension Methods

Name Description
AddOAuthFlow(TeamsBotApplication, OAuthOptions)

Register an OAuthFlow with OAuthOptions that configure both the connection name and the default OAuthCard text shown during sign-in. Per-call options passed to SignInAsync<TActivity>(Context<TActivity>, OAuthOptions, CancellationToken) override these defaults.

AddOAuthFlow(TeamsBotApplication, String)

Register an OAuthFlow with an explicit OAuth connection name.

OnAdaptiveCardAction(TeamsBotApplication, AdaptiveCardActionHandler)

Registers a handler for adaptive card action invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnAgenticUserDeleted(TeamsBotApplication, AgenticUserDeletedHandler)

Registers a handler for AgenticUserDeleted lifecycle event activities.

OnAgenticUserDisabled(TeamsBotApplication, AgenticUserDisabledHandler)

Registers a handler for AgenticUserDisabled lifecycle event activities.

OnAgenticUserEnabled(TeamsBotApplication, AgenticUserEnabledHandler)

Registers a handler for AgenticUserEnabled lifecycle event activities.

OnAgenticUserIdentityCreated(TeamsBotApplication, AgenticUserIdentityCreatedHandler)

Registers a handler for AgenticUserIdentityCreated lifecycle event activities.

OnAgenticUserIdentityUpdated(TeamsBotApplication, AgenticUserIdentityUpdatedHandler)

Registers a handler for AgenticUserIdentityUpdated lifecycle event activities.

OnAgenticUserManagerUpdated(TeamsBotApplication, AgenticUserManagerUpdatedHandler)

Registers a handler for AgenticUserManagerUpdated lifecycle event activities.

OnAgenticUserUndeleted(TeamsBotApplication, AgenticUserUndeletedHandler)

Registers a handler for AgenticUserUndeleted lifecycle event activities.

OnAgenticUserWorkloadOnboardingUpdated(TeamsBotApplication, AgenticUserWorkloadOnboardingUpdatedHandler)

Registers a handler for AgenticUserWorkloadOnboardingUpdated lifecycle event activities.

OnAgentLifecycle(TeamsBotApplication, AgentLifecycleHandler)

Registers a handler for all Agent 365 agentLifecycle event activity variants.

OnAnonQueryLink(TeamsBotApplication, MessageExtensionAnonQueryLinkHandler)

Registers a handler for message extension anonymous query link invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnCardButtonClicked(TeamsBotApplication, OnCardButtonClickedHandler)

Registers a handler for message extension card button clicked invoke activities. Called when a user clicks an Action.Submit button on a message extension result card. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnChannelCreated(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel created events.

OnChannelDeleted(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel deleted events.

OnChannelMemberAdded(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel member added events.

OnChannelMemberRemoved(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel member removed events.

OnChannelRenamed(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel renamed events.

OnChannelRestored(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel restored events.

OnChannelShared(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel shared events.

OnChannelUnshared(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for channel unshared events.

OnConversationUpdate(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for conversation update activities.

OnEvent(TeamsBotApplication, EventActivityHandler)

Registers a handler for all event activities.

OnFetchTask(TeamsBotApplication, MessageExtensionFetchTaskHandler)

Registers a handler for message extension fetch task invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnFileConsent(TeamsBotApplication, FileConsentValueHandler)

Registers a handler for file consent invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnInstall(TeamsBotApplication, InstallUpdateHandler)

Registers a handler for installation add activities.

OnInstallUpdate(TeamsBotApplication, InstallUpdateHandler)

Registers a handler for installation update activities.

OnInvoke(TeamsBotApplication, InvokeHandler)

Registers a catch-all handler for all invoke activities. Cannot be combined with specific invoke handlers such as OnAdaptiveCardAction(TeamsBotApplication, AdaptiveCardActionHandler), OnTaskFetch(TeamsBotApplication, TaskModuleHandler), etc.

OnMeetingEnd(TeamsBotApplication, MeetingEndHandler)

Registers a handler for meeting end event activities.

OnMeetingJoin(TeamsBotApplication, MeetingParticipantJoinHandler)

Registers a handler for meeting participant join event activities.

OnMeetingLeave(TeamsBotApplication, MeetingParticipantLeaveHandler)

Registers a handler for meeting participant leave event activities.

OnMeetingStart(TeamsBotApplication, MeetingStartHandler)

Registers a handler for meeting start event activities.

OnMembersAdded(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for conversation update activities where members were added.

OnMembersRemoved(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for conversation update activities where members were removed.

OnMessage(TeamsBotApplication, MessageHandler)

Registers a handler for message activities.

OnMessage(TeamsBotApplication, Regex, MessageHandler)

Registers a handler for message activities matching the specified regex.

OnMessage(TeamsBotApplication, String, MessageHandler)

Registers a handler for message activities matching the specified pattern.

OnMessageDelete(TeamsBotApplication, MessageDeleteHandler)

Registers a handler for message delete activities.

OnMessageFetchTask(TeamsBotApplication, MessageFetchTaskHandler)

Registers a handler for message fetch task invoke activities (message/fetchTask). Triggered when the user clicks a feedback button on an AI-generated message. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnMessageReaction(TeamsBotApplication, MessageReactionHandler)

Registers a handler for message reaction activities.

OnMessageReactionAdded(TeamsBotApplication, MessageReactionHandler)

Registers a handler for message reaction activities where reactions were added.

OnMessageReactionRemoved(TeamsBotApplication, MessageReactionHandler)

Registers a handler for message reaction activities where reactions were removed.

OnMessageSubmitAction(TeamsBotApplication, MessageSubmitActionHandler)

Registers a handler for message submit action invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnMessageSubmitFeedback(TeamsBotApplication, MessageSubmitFeedbackHandler)

Registers a handler for message/submitAction invokes where actionName == "feedback". The handler receives the inner actionValue typed as MessageSubmitFeedbackValue. Register this before any general OnMessageSubmitAction(TeamsBotApplication, MessageSubmitActionHandler) so the feedback-specific route wins on first-match dispatch.

OnMessageUpdate(TeamsBotApplication, MessageUpdateHandler)

Registers a handler for message update activities.

OnQuery(TeamsBotApplication, MessageExtensionQueryHandler)

Registers a handler for message extension query invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnQueryLink(TeamsBotApplication, MessageExtensionQueryLinkHandler)

Registers a handler for message extension query link invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnQuerySettingUrl(TeamsBotApplication, MessageExtensionQuerySettingUrlHandler)

Registers a handler for message extension query setting URL invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnSearch(TeamsBotApplication, SearchHandler)

Registers a handler for 'application/search' invoke activities. The handler returns an InvokeResponse<TBody> carrying a SearchResponse body. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnSelectItem(TeamsBotApplication, MessageExtensionSelectItemHandler)

Registers a handler for message extension select item invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnSetting(TeamsBotApplication, MessageExtensionSettingsHandler)

Registers a handler for message extension setting invoke activities. Called by Teams when the user saves settings after the config URL popup. Must be paired with OnQuerySettingUrl(TeamsBotApplication, MessageExtensionQuerySettingUrlHandler) to complete the settings flow.

OnSubmitAction(TeamsBotApplication, MessageExtensionSubmitActionHandler)

Registers a handler for message extension submit action invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnSuggestedActionSubmit(TeamsBotApplication, SuggestedActionSubmitHandler)

Registers a handler for suggestedActions/submit invoke activities. Triggered when the user clicks a suggested action of type Action.Submit. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnTaskFetch(TeamsBotApplication, TaskModuleHandler)

Registers a handler for task module fetch invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnTaskSubmit(TeamsBotApplication, TaskModuleHandler)

Registers a handler for task module submit invoke activities. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

OnTeamArchived(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for team archived events.

OnTeamDeleted(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for team deleted events.

OnTeamMemberAdded(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for team member added events.

OnTeamMemberRemoved(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for team member removed events.

OnTeamRenamed(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for team renamed events.

OnTeamRestored(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for team restored events.

OnTeamUnarchived(TeamsBotApplication, ConversationUpdateHandler)

Registers a handler for team unarchived events.

OnUnInstall(TeamsBotApplication, InstallUpdateHandler)

Registers a handler for installation remove activities.

OnWidgetCallTool(TeamsBotApplication, HtmlWidgetCallToolHandler)

Registers a handler for htmlwidget/calltool invoke activities. Triggered when a widget calls a tool on the bot. Cannot be combined with OnInvoke(TeamsBotApplication, InvokeHandler).

Applies to