botbuilder-core package

Classes

ActivityFactory

The ActivityFactory to generate text and then uses simple markdown semantics like chatdown to create Activity.

ActivityHandler

Event-emitting activity handler for bots. Extends ActivityHandlerBase.

ActivityHandlerBase

Defines the core behavior for event-emitting activity handlers for bots.

AutoSaveStateMiddleware

Middleware that will automatically save any state changes at the end of the turn.

BotAdapter

Defines the core behavior of a bot adapter that can connect a bot to a service endpoint.

BotComponent

Definition of a BotComponent that allows registration of services, custom actions, memory scopes and adapters. To make your components available to the system you derive from BotComponent and register services to add functionality. These components then are consumed in appropriate places by the systems that need them. When using Composer, configureServices gets called automatically on the components by the bot runtime, as long as the components are registered in the configuration.

BotState

Base class for the frameworks state persistance scopes.

BotStatePropertyAccessor

A BotState specific implementation of the StatePropertyAccessor interface.

BotStateSet

A collection of BotState plugins that should be loaded or saved in parallel as a single unit. See AutoSaveStateMiddleware for an implementation of this class.

NullTelemetryClient

A null bot telemetry client that implements BotTelemetryClient.

BrowserLocalStorage

Storage provider that uses browser local storage.

BrowserSessionStorage

Storage provider that uses browser session storage.

CardFactory

Provides methods for formatting the various card types a bot can return.

CloudAdapterBase

An adapter that implements the Bot Framework Protocol and can be hosted in different cloud environments both public and private.

ComponentRegistration

ComponentRegistration is a signature class for discovering assets from components.

ConfigurationBotFrameworkAuthentication

Creates a BotFrameworkAuthentication instance from an object with the authentication values or a Configuration instance.

ConfigurationServiceClientCredentialFactory

ServiceClientCredentialsFactory that uses a ConfigurationServiceClientCredentialFactoryOptions or a Configuration instance to build ServiceClientCredentials with an AppId and App Password.

ConversationState

Reads and writes conversation state for your bot to storage.

InvokeException

A custom exception for invoke response errors.

MemoryStorage

Memory based storage provider for a bot.

MemoryTranscriptStore

The memory transcript store stores transcripts in volatile memory in a Map.

MessageFactory

A set of utility functions to assist with the formatting of the various message types a bot can return.

MiddlewareSet

A set of Middleware plugins.

PrivateConversationState

Reads and writes PrivateConversation state for your bot to storage.

QueueStorage

A base class for enqueueing an Activity for later processing.

RegisterClassMiddleware

Middleware for adding an object to or registering a service with the current turn context.

ShowTypingMiddleware

Middleware that will send a typing indicator automatically for each message.

SkillConversationIdFactory

A SkillConversationIdFactory that stores and retrieves ConversationReference instances.

SkillConversationIdFactoryBase

Defines the methods of a factory that is used to create unique conversation IDs for skill conversations.

SkypeMentionNormalizeMiddleware

Middleware to patch mention Entities from Skype since they don't conform to expected values. Bots that interact with Skype should use this middleware if mentions are used.

StringUtils

Helper class containing string utility methods.

TelemetryConstants

Defines names of common properties for use with a BotTelemetryClient object.

TelemetryLoggerMiddleware

Middleware for logging incoming, outgoing, updated or deleted Activity messages. Uses the botTelemetryClient interface.

TestAdapter

Test adapter used for unit tests. This adapter can be used to simulate sending messages from the user to the bot.

TestFlow

Support class for TestAdapter that allows for the simple construction of a sequence of tests.

ConsoleTranscriptLogger

ConsoleTranscriptLogger , writes activities to Console output.

TranscriptLoggerMiddleware

Logs incoming and outgoing activities to a TranscriptStore.

TurnContext

Provides context for a turn of a bot.

TurnContextStateCollection

Values persisted for the lifetime of the turn as part of the TurnContext.

UserState

Reads and writes user state for your bot to storage.

Interfaces

CachedBotState

State information cached off the context object by a BotState instance.

StatePropertyAccessor

Defines methods for accessing a state property created in a BotState object.

BotPageViewTelemetryClient
BotTelemetryClient
TelemetryDependency
TelemetryEvent
TelemetryException
TelemetryPageView
TelemetryTrace
CoreAppCredentials

CoreAppCredentials

CoreWebResource

Internal interface representing the "WebResource" from @azure/ms-rest-js

ExtendedUserTokenProvider

Interface for User Token OAuth Single Sign On and Token Exchange APIs for BotAdapters

IntentScore

Score plus any extra information about an intent.

Middleware

Interface implemented by object based middleware.

PropertyManager

Interface implemented by classes capable of factoring property accessors.

RecognizerResult

Value returned from a recognizer.

BotFrameworkSkill

Registration for a BotFrameworkHttpProtocol based Skill endpoint.

SkillConversationIdFactoryOptions
SkillConversationReference
Storage

Interface for a storage provider that stores and retrieves plain old JSON objects.

StoreItem

Object which is stored in Storage with an optional eTag.

StoreItems

Map of named StoreItem objects.

PagedResult

Page of results.

TranscriptInfo

Metadata for a stored transcript.

TranscriptLogger

Transcript logger stores activities for conversations for recall.

TranscriptStore

Transcript logger stores activities for conversations for recall.

IUserTokenProvider

Interface for User Token OAuth APIs for BotAdapters

TokenPollingSettings

Provides details for token polling.

Type Aliases

BotHandler

Describes a bot activity event handler, for use with an ActivityHandler object.

ConfigurationBotFrameworkAuthenticationOptions

Contains settings used to configure a ConfigurationBotFrameworkAuthentication instance.

ConfigurationServiceClientCredentialFactoryOptions

Contains settings used to configure a ConfigurationServiceClientCredentialFactory instance.

MiddlewareHandler

Signature implemented by function based middleware.

type MiddlewareHandler = (context: TurnContext, next: () => Promise<void>) => Promise<void>;
StorageKeyFactory

Callback to calculate a storage key.

type StorageKeyFactory = (context: TurnContext) => Promise<string>;
TestActivityInspector

Signature for a function that can be used to inspect individual activities returned by a bot that's being tested using the TestAdapter.

type TestActivityInspector = (activity: Partial<Activity>, description: string) => void;
DeleteActivityHandler

A handler that can participate in delete activity events for the current turn.

SendActivitiesHandler

A handler that can participate in send activity events for the current turn.

UpdateActivityHandler

A handler that can participate in update activity events for the current turn.

Enums

Severity

Defines the level of severity for the event.

Functions

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.

assertBotComponent(unknown, unknown[])
telemetryTrackDialogView(BotTelemetryClient, string, [key: string]: any, [key: string]: number)

Logs a DialogView using the trackPageView method on the BotTelemetryClient if BotPageViewTelemetryClient has been implemented. Alternatively logs the information out via TrackTrace.

createBotFrameworkAuthenticationFromConfiguration(Configuration, ServiceClientCredentialsFactory, AuthenticationConfiguration, (input: RequestInfo, init?: RequestInit) => Promise<Response>, ConnectorClientOptions)

Creates a new instance of the ConfigurationBotFrameworkAuthentication class.

createServiceClientCredentialFactoryFromConfiguration(Configuration)

Creates a new instance of the ConfigurationServiceClientCredentialFactory class.

assertStoreItems(unknown, unknown[])
calculateChangeHash(StoreItem)

Utility function to calculate a change hash for a StoreItem.

Function Details

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.

function useBotState(botAdapter: BotAdapter, botStates: BotState[]): BotAdapter

Parameters

botAdapter
BotAdapter

The adapter on which to register the state objects.

botStates

BotState[]

The state objects to register.

Returns

The updated adapter.

assertBotComponent(unknown, unknown[])

Warning

This API is now deprecated.

Use BotComponent.z.parse() instead.

function assertBotComponent(val: unknown, _args: unknown[]): asserts

Parameters

val

unknown

_args

unknown[]

Returns

asserts

telemetryTrackDialogView(BotTelemetryClient, string, [key: string]: any, [key: string]: number)

Logs a DialogView using the trackPageView method on the BotTelemetryClient if BotPageViewTelemetryClient has been implemented. Alternatively logs the information out via TrackTrace.

function telemetryTrackDialogView(telemetryClient: BotTelemetryClient, dialogName: string, properties?: [key: string]: any, metrics?: [key: string]: number)

Parameters

telemetryClient
BotTelemetryClient

TelemetryClient that implements BotTelemetryClient.

dialogName

string

Name of the dialog to log the entry / start for.

properties

[key: string]: any

Named string values you can use to search and classify events.

metrics

[key: string]: number

Measurements associated with this event.

createBotFrameworkAuthenticationFromConfiguration(Configuration, ServiceClientCredentialsFactory, AuthenticationConfiguration, (input: RequestInfo, init?: RequestInit) => Promise<Response>, ConnectorClientOptions)

Creates a new instance of the ConfigurationBotFrameworkAuthentication class.

function createBotFrameworkAuthenticationFromConfiguration(configuration: Configuration, credentialsFactory?: ServiceClientCredentialsFactory, authConfiguration?: AuthenticationConfiguration, botFrameworkClientFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, connectorClientOptions?: ConnectorClientOptions): BotFrameworkAuthentication

Parameters

configuration

Configuration

A Configuration instance.

credentialsFactory

ServiceClientCredentialsFactory

A ServiceClientCredentialsFactory instance.

authConfiguration

AuthenticationConfiguration

A Configuration object.

botFrameworkClientFetch

(input: RequestInfo, init?: RequestInit) => Promise<Response>

A custom Fetch implementation to be used in the BotFrameworkClient.

connectorClientOptions

ConnectorClientOptions

A ConnectorClientOptions object.

Returns

BotFrameworkAuthentication

A ConfigurationBotFrameworkAuthentication instance.

Remarks

The Configuration instance provided to the constructor should have the desired authentication values available at the root, using the properties of ConfigurationBotFrameworkAuthenticationOptions as its keys.

createServiceClientCredentialFactoryFromConfiguration(Configuration)

Creates a new instance of the ConfigurationServiceClientCredentialFactory class.

function createServiceClientCredentialFactoryFromConfiguration(configuration: Configuration): ConfigurationServiceClientCredentialFactory

Parameters

configuration

Configuration

A Configuration instance.

Returns

A ConfigurationServiceClientCredentialFactory instance.

Remarks

The Configuration instance provided to the constructor should have the desired authentication values available at the root, using the properties of ConfigurationServiceClientCredentialFactoryOptions as its keys.

assertStoreItems(unknown, unknown[])

Warning

This API is now deprecated.

Use zod.record(zod.unknown()) instead.

function assertStoreItems(val: unknown, _args: unknown[]): asserts

Parameters

val

unknown

_args

unknown[]

Returns

asserts

calculateChangeHash(StoreItem)

Utility function to calculate a change hash for a StoreItem.

function calculateChangeHash(item: StoreItem): string

Parameters

item
StoreItem

Item to calculate the change hash for.

Returns

string

change hash string

Remarks

This example calculates a change hash for an object that's been read in and then only writes it back out if it's been modified:

// Calculate state objects initial hash
const hash = calculateChangeHash(state);

// Process the received activity
await processActivity(context, state);

// Save state if changed
if (calculateChangeHash(state) !== hash) {
   await storage.write({ 'botState': state });
}