BotFrameworkAdapter Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A bot adapter that can connect a bot to a service endpoint.
public class BotFrameworkAdapter : Microsoft.Bot.Builder.BotAdapter, Microsoft.Bot.Builder.IExtendedUserTokenProvider, Microsoft.Bot.Builder.Integration.IAdapterIntegration, Microsoft.Bot.Builder.OAuth.IConnectorClientBuilder
type BotFrameworkAdapter = class
inherit BotAdapter
interface IAdapterIntegration
interface IExtendedUserTokenProvider
interface IUserTokenProvider
interface IConnectorClientBuilder
Public Class BotFrameworkAdapter
Inherits BotAdapter
Implements IAdapterIntegration, IConnectorClientBuilder, IExtendedUserTokenProvider
- Inheritance
- Derived
- Implements
Remarks
BotFrameworkAdapter is still supported but the recommended adapter is `CloudAdapter`. The bot adapter encapsulates authentication processes and sends activities to and receives activities from the Bot Connector Service. When your bot receives an activity, the adapter creates a context object, passes it to your bot's application logic, and sends responses back to the user's channel.
Use Use(IMiddleware) to add IMiddleware objects to your adapter’s middleware collection. The adapter processes and directs incoming activities in through the bot middleware pipeline to your bot’s logic and then back out again. As each activity flows in and out of the bot, each piece of middleware can inspect or act upon the activity, both before and after the bot logic runs.
Constructors
BotFrameworkAdapter(AppCredentials, AuthenticationConfiguration, IChannelProvider, RetryPolicy, HttpClient, IMiddleware, ILogger) |
Initializes a new instance of the BotFrameworkAdapter class, using a credential provider. |
BotFrameworkAdapter(ICredentialProvider, AuthenticationConfiguration, IChannelProvider, RetryPolicy, HttpClient, IMiddleware, ILogger) |
Initializes a new instance of the BotFrameworkAdapter class, using a credential provider. |
BotFrameworkAdapter(ICredentialProvider, IChannelProvider, RetryPolicy, HttpClient, IMiddleware, ILogger) |
Initializes a new instance of the BotFrameworkAdapter class, using a credential provider. |
Fields
BotIdentityKey |
The string value for the bot identity key. (Inherited from BotAdapter) |
InvokeResponseKey |
The key value for any InvokeResponseActivity that would be on the TurnState. (Inherited from BotAdapter) |
OAuthScopeKey |
The string value for the OAuth scope key. (Inherited from BotAdapter) |
Properties
AppCredentialMap |
Gets the map of applications to AppCredentials for this adapter. |
ChannelProvider |
Gets the channel provider for this adapter. |
CredentialProvider |
Gets the credential provider for this adapter. |
HttpClient |
Gets the custom HttpClient for this adapter if specified. |
Logger |
Gets the logger for this adapter. |
MiddlewareSet |
Gets the collection of middleware in the adapter's pipeline. (Inherited from BotAdapter) |
OnTurnError |
Gets or sets an error handler that can catch exceptions in the middleware or application. (Inherited from BotAdapter) |
Methods
BuildCredentialsAsync(String, String) |
Logic to build an AppCredentials object to be used to acquire tokens for this HttpClient. |
CanProcessOutgoingActivity(Activity) |
Opportunity for subclasses to opt in to process an outgoing activity. |
ContinueConversationAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken) |
Sends a proactive message to a conversation. (Inherited from BotAdapter) |
ContinueConversationAsync(ClaimsIdentity, Activity, String, BotCallbackHandler, CancellationToken) |
Sends a proactive message to a conversation. (Inherited from BotAdapter) |
ContinueConversationAsync(ClaimsIdentity, ConversationReference, BotCallbackHandler, CancellationToken) |
Sends a proactive message from the bot to a conversation. |
ContinueConversationAsync(ClaimsIdentity, ConversationReference, String, BotCallbackHandler, CancellationToken) |
Sends a proactive message from the bot to a conversation. |
ContinueConversationAsync(String, Activity, BotCallbackHandler, CancellationToken) |
Sends a proactive message to a conversation. (Inherited from BotAdapter) |
ContinueConversationAsync(String, ConversationReference, BotCallbackHandler, CancellationToken) |
Sends a proactive message from the bot to a conversation. |
CreateConversationAsync(String, String, AppCredentials, ConversationParameters, BotCallbackHandler, CancellationToken) |
Creates a conversation on the specified channel. |
CreateConversationAsync(String, String, AppCredentials, ConversationParameters, BotCallbackHandler, ConversationReference, CancellationToken) |
Obsolete.
Creates a conversation on the specified channel. Overload receives a ConversationReference including the tenant. |
CreateConversationAsync(String, String, MicrosoftAppCredentials, ConversationParameters, BotCallbackHandler, CancellationToken) |
Creates a conversation on the specified channel. |
CreateConversationAsync(String, String, MicrosoftAppCredentials, ConversationParameters, BotCallbackHandler, ConversationReference, CancellationToken) |
Obsolete.
Creates a conversation on the specified channel. Overload receives a ConversationReference including the tenant. |
CreateConversationAsync(String, String, String, String, ConversationParameters, BotCallbackHandler, CancellationToken) |
Creates a conversation on the specified channel. (Inherited from BotAdapter) |
CreateOAuthApiClientAsync(ITurnContext, AppCredentials) |
Creates an OAuth client for the bot with the credentials. |
CreateOAuthApiClientAsync(ITurnContext) |
Creates an OAuth client for the bot. |
DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken) |
Deletes an existing activity in the conversation. |
DeleteConversationMemberAsync(ITurnContext, String, CancellationToken) |
Removes a member from the current conversation. |
ExchangeTokenAsync(ITurnContext, AppCredentials, String, String, TokenExchangeRequest, CancellationToken) |
Performs a token exchange operation such as for single sign-on. |
ExchangeTokenAsync(ITurnContext, String, String, TokenExchangeRequest, CancellationToken) |
Performs a token exchange operation such as for single sign-on. |
GetAadTokensAsync(ITurnContext, AppCredentials, String, String[], String, CancellationToken) |
Retrieves Azure Active Directory tokens for particular resources on a configured connection, using customized AppCredentials. |
GetAadTokensAsync(ITurnContext, String, String[], String, CancellationToken) |
Retrieves Azure Active Directory tokens for particular resources on a configured connection, using the bot's AppCredentials. |
GetActivityMembersAsync(ITurnContext, String, CancellationToken) |
Lists the members of a given activity. |
GetConversationMembersAsync(ITurnContext, CancellationToken) |
Lists the members of the current conversation. |
GetConversationsAsync(ITurnContext, String, CancellationToken) |
Lists the Conversations in which this bot has participated for a given channel server. The
channel server returns results in pages and each page will include a |
GetConversationsAsync(String, MicrosoftAppCredentials, String, CancellationToken) |
Lists the Conversations in which this bot has participated for a given channel server. The
channel server returns results in pages and each page will include a |
GetOauthSignInLinkAsync(ITurnContext, AppCredentials, String, CancellationToken) |
Get the raw signin link to be sent to the user for signin for a connection name, using customized AppCredentials. |
GetOauthSignInLinkAsync(ITurnContext, AppCredentials, String, String, String, CancellationToken) |
Get the raw signin link to be sent to the user for signin for a connection name, using customized AppCredentials. |
GetOauthSignInLinkAsync(ITurnContext, String, CancellationToken) |
Get the raw signin link to be sent to the user for signin for a connection name, using the bot's AppCredentials. |
GetOauthSignInLinkAsync(ITurnContext, String, String, String, CancellationToken) |
Get the raw signin link to be sent to the user for signin for a connection name, using the bot's AppCredentials. |
GetSignInResourceAsync(ITurnContext, AppCredentials, String, String, String, CancellationToken) |
Get the raw signin link to be sent to the user for signin for a connection name. |
GetSignInResourceAsync(ITurnContext, String, CancellationToken) |
Get the raw signin link to be sent to the user for signin for a connection name. |
GetSignInResourceAsync(ITurnContext, String, String, String, CancellationToken) |
Get the raw signin link to be sent to the user for signin for a connection name. |
GetTokenStatusAsync(ITurnContext, AppCredentials, String, String, CancellationToken) |
Retrieves the token status for each configured connection for the given user, using customized AppCredentials. |
GetTokenStatusAsync(ITurnContext, String, String, CancellationToken) |
Retrieves the token status for each configured connection for the given user, using the bot's AppCredentials. |
GetUserTokenAsync(ITurnContext, AppCredentials, String, String, CancellationToken) |
Attempts to retrieve the token for a user that's in a login flow, using customized AppCredentials. |
GetUserTokenAsync(ITurnContext, String, String, CancellationToken) |
Attempts to retrieve the token for a user that's in a login flow, using the bot's AppCredentials. |
ProcessActivityAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken) |
Creates a turn context and runs the middleware pipeline for an incoming activity. |
ProcessActivityAsync(String, Activity, BotCallbackHandler, CancellationToken) |
Creates a turn context and runs the middleware pipeline for an incoming activity. |
ProcessOutgoingActivityAsync(ITurnContext, Activity, CancellationToken) |
Custom logic to send an outgoing activity. Subclasses can override this method along with CanProcessOutgoingActivity to have custom logic to process the outgoing activity. |
RunPipelineAsync(ITurnContext, BotCallbackHandler, CancellationToken) |
Starts activity processing for the current bot turn. (Inherited from BotAdapter) |
SendActivitiesAsync(ITurnContext, Activity[], CancellationToken) |
Sends activities to the conversation. |
SignOutUserAsync(ITurnContext, AppCredentials, String, String, CancellationToken) |
Signs the user out with the token server, using customized AppCredentials. |
SignOutUserAsync(ITurnContext, String, String, CancellationToken) |
Signs the user out with the token server, using the bot's AppCredentials. |
UpdateActivityAsync(ITurnContext, Activity, CancellationToken) |
Replaces an existing activity in the conversation. |
Use(IMiddleware) |
Adds middleware to the adapter's pipeline. |
Explicit Interface Implementations
IConnectorClientBuilder.CreateConnectorClientAsync(String, ClaimsIdentity, String, CancellationToken) |
Extension Methods
UseBotState(BotAdapter, BotState[]) |
Adds middleware to the adapter to register one or more BotState objects on the turn context. The middleware registers the state objects on the turn context at the start of each turn. |
UseState(BotAdapter, UserState, ConversationState, Boolean) |
Obsolete.
Registers user and conversation state objects with the adapter. These objects will be available via the turn context's TurnState.Get<T>() method. |
UseStorage(BotAdapter, IStorage) |
Adds middleware to the adapter to register an IStorage object on the turn context. The middleware registers the state objects on the turn context at the start of each turn. |