Share via


BotAdapter Class

Definition

Represents a bot adapter that can connect a bot to a service endpoint. This class is abstract.

public abstract class BotAdapter
type BotAdapter = class
Public MustInherit Class BotAdapter
Inheritance
BotAdapter
Derived

Remarks

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

BotAdapter()

Initializes a new instance of the BotAdapter class.

Fields

BotIdentityKey

The string value for the bot identity key.

InvokeResponseKey

The key value for any InvokeResponseActivity that would be on the TurnState.

OAuthScopeKey

The string value for the OAuth scope key.

Properties

MiddlewareSet

Gets the collection of middleware in the adapter's pipeline.

OnTurnError

Gets or sets an error handler that can catch exceptions in the middleware or application.

Methods

ContinueConversationAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

ContinueConversationAsync(ClaimsIdentity, Activity, String, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

ContinueConversationAsync(ClaimsIdentity, ConversationReference, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

ContinueConversationAsync(ClaimsIdentity, ConversationReference, String, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

ContinueConversationAsync(String, Activity, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

ContinueConversationAsync(String, ConversationReference, BotCallbackHandler, CancellationToken)

Sends a proactive message to a conversation.

CreateConversationAsync(String, String, String, String, ConversationParameters, BotCallbackHandler, CancellationToken)

Creates a conversation on the specified channel.

DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken)

When overridden in a derived class, deletes an existing activity in the conversation.

ProcessActivityAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken)

Creates a turn context and runs the middleware pipeline for an incoming TRUSTED activity.

RunPipelineAsync(ITurnContext, BotCallbackHandler, CancellationToken)

Starts activity processing for the current bot turn.

SendActivitiesAsync(ITurnContext, Activity[], CancellationToken)

When overridden in a derived class, sends activities to the conversation.

UpdateActivityAsync(ITurnContext, Activity, CancellationToken)

When overridden in a derived class, replaces an existing activity in the conversation.

Use(IMiddleware)

Adds middleware to the adapter's pipeline.

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.

Applies to

See also