botbuilder
- Version 4.23.1
- Published
- 1.23 MB
- 14 dependencies
- MIT license
Install
npm i botbuilder
yarn add botbuilder
pnpm add botbuilder
Overview
Bot Builder is a framework for building rich bots on virtually any platform.
Index
Functions
Classes
BotFrameworkAdapter
- authenticateRequest()
- buildCredentials()
- checkEmulatingOAuthCards()
- continueConversation()
- createConnectorClient()
- createConnectorClientWithIdentity()
- createContext()
- createConversation()
- createTokenApiClient()
- credentials
- credentialsProvider
- deleteActivity()
- deleteConversationMember()
- emulateOAuthCards()
- exchangeToken()
- getAadTokens()
- getActivityMembers()
- getConversationMembers()
- getConversations()
- getSignInLink()
- getSignInResource()
- getTokenStatus()
- getUserToken()
- isStreamingConnectionOpen
- oauthApiUrl()
- process()
- processActivity()
- processActivityDirect()
- processRequest()
- sendActivities()
- settings
- signOutUser()
- TokenApiClientCredentialsKey
- updateActivity()
- useNamedPipe()
- useWebSocket()
ChannelServiceHandlerBase
- authenticate()
- handleCreateConversation()
- handleDeleteActivity()
- handleDeleteConversationMember()
- handleGetActivityMembers()
- handleGetConversationMember()
- handleGetConversationMembers()
- handleGetConversationPagedMembers()
- handleGetConversations()
- handleReplyToActivity()
- handleSendConversationHistory()
- handleSendToConversation()
- handleUpdateActivity()
- handleUploadAttachment()
- onCreateConversation()
- onDeleteActivity()
- onDeleteConversationMember()
- onGetActivityMembers()
- onGetConversationMember()
- onGetConversationMembers()
- onGetConversationPagedMembers()
- onGetConversations()
- onReplyToActivity()
- onSendConversationHistory()
- onSendToConversation()
- onUpdateActivity()
- onUploadAttachment()
TeamsActivityHandler
- dispatchConversationUpdateActivity()
- dispatchEventActivity()
- dispatchMessageDeleteActivity()
- dispatchMessageUpdateActivity()
- handleTeamsAnonymousAppBasedLinkQuery()
- handleTeamsAppBasedLinkQuery()
- handleTeamsCardActionInvoke()
- handleTeamsConfigFetch()
- handleTeamsConfigSubmit()
- handleTeamsFileConsent()
- handleTeamsFileConsentAccept()
- handleTeamsFileConsentDecline()
- handleTeamsMessagingExtensionBotMessagePreviewEdit()
- handleTeamsMessagingExtensionBotMessagePreviewSend()
- handleTeamsMessagingExtensionCardButtonClicked()
- handleTeamsMessagingExtensionConfigurationQuerySettingUrl()
- handleTeamsMessagingExtensionConfigurationSetting()
- handleTeamsMessagingExtensionFetchTask()
- handleTeamsMessagingExtensionQuery()
- handleTeamsMessagingExtensionSelectItem()
- handleTeamsMessagingExtensionSubmitAction()
- handleTeamsMessagingExtensionSubmitActionDispatch()
- handleTeamsO365ConnectorCardAction()
- handleTeamsSigninTokenExchange()
- handleTeamsSigninVerifyState()
- handleTeamsTabFetch()
- handleTeamsTabSubmit()
- handleTeamsTaskModuleFetch()
- handleTeamsTaskModuleSubmit()
- onInvokeActivity()
- onSignInInvoke()
- onTeamsChannelCreated()
- onTeamsChannelCreatedEvent()
- onTeamsChannelDeleted()
- onTeamsChannelDeletedEvent()
- onTeamsChannelRenamed()
- onTeamsChannelRenamedEvent()
- onTeamsChannelRestored()
- onTeamsChannelRestoredEvent()
- onTeamsMeetingEnd()
- onTeamsMeetingEndEvent()
- onTeamsMeetingParticipantsJoin()
- onTeamsMeetingParticipantsJoinEvent()
- onTeamsMeetingParticipantsLeave()
- onTeamsMeetingParticipantsLeaveEvent()
- onTeamsMeetingStart()
- onTeamsMeetingStartEvent()
- onTeamsMembersAdded()
- onTeamsMembersAddedEvent()
- onTeamsMembersRemoved()
- onTeamsMembersRemovedEvent()
- onTeamsMessageEdit()
- onTeamsMessageEditEvent()
- onTeamsMessageSoftDelete()
- onTeamsMessageSoftDeleteEvent()
- onTeamsMessageUndelete()
- onTeamsMessageUndeleteEvent()
- onTeamsReadReceipt()
- onTeamsReadReceiptEvent()
- onTeamsTeamArchived()
- onTeamsTeamArchivedEvent()
- onTeamsTeamDeleted()
- onTeamsTeamDeletedEvent()
- onTeamsTeamHardDeleted()
- onTeamsTeamHardDeletedEvent()
- onTeamsTeamRenamed()
- onTeamsTeamRenamedEvent()
- onTeamsTeamRestored()
- onTeamsTeamRestoredEvent()
- onTeamsTeamUnarchived()
- onTeamsTeamUnarchivedEvent()
TeamsInfo
- cancelOperation()
- getFailedEntries()
- getMeetingInfo()
- getMeetingParticipant()
- getMember()
- getMembers()
- getOperationState()
- getPagedMembers()
- getPagedTeamMembers()
- getTeamChannels()
- getTeamDetails()
- getTeamMember()
- getTeamMembers()
- sendMeetingNotification()
- sendMessageToAllUsersInTeam()
- sendMessageToAllUsersInTenant()
- sendMessageToListOfChannels()
- sendMessageToListOfUsers()
- sendMessageToTeamsChannel()
Interfaces
Type Aliases
Functions
function teamsGetChannelId
teamsGetChannelId: (activity: Activity) => string | null;
Activity helper methods for Teams.
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Returns
The current [Activity](xref:botframework-schema.Activity)'s team's channel id, or null.
function teamsGetSelectedChannelId
teamsGetSelectedChannelId: (activity: Activity) => string;
Gets the Team's selected channel id from the current activity.
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Returns
The current activity's team's selected channel, or empty string.
function teamsGetTeamId
teamsGetTeamId: (activity: Activity) => string | null;
Gets the Team Id from the current [Activity](xref:botframework-schema.Activity).
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Returns
The current [Activity](xref:botframework-schema.Activity)'s team's Id, or null.
function teamsGetTeamInfo
teamsGetTeamInfo: (activity: Activity) => TeamInfo | null;
Gets the TeamsInfo object from the current [Activity](xref:botframework-schema.Activity).
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Returns
The current [Activity](xref:botframework-schema.Activity)'s team's info, or null.
function teamsGetTeamMeetingInfo
teamsGetTeamMeetingInfo: (activity: Activity) => TeamsMeetingInfo | null;
Gets the TeamsMeetingInfo object from the current [Activity](xref:botframework-schema.Activity).
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Returns
The current [Activity](xref:botframework-schema.Activity)'s team meeting info, or null.
function teamsGetTeamOnBehalfOf
teamsGetTeamOnBehalfOf: (activity: Activity) => OnBehalfOf[];
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Returns
The current [Activity](xref:botframework-schema.Activity)'s team's onBehalfOf list, or null.
function teamsGetTenant
teamsGetTenant: (activity: Activity) => TenantInfo | null;
Gets the TenantInfo object from the current [Activity](xref:botframework-schema.Activity).
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Returns
The current [Activity](xref:botframework-schema.Activity)'s tenant info, or null.
function teamsNotifyUser
teamsNotifyUser: ( activity: Activity, alertInMeeting?: boolean, externalResourceUrl?: string) => void;
Configures the current [Activity](xref:botframework-schema.Activity) to generate a notification within Teams.
Parameter activity
The current [Activity](xref:botframework-schema.Activity).
Parameter alertInMeeting
Sent to a meeting chat, this will cause the Teams client to render it in a notification popup as well as in the chat thread.
Parameter externalResourceUrl
Url to external resource. Must be included in manifest's valid domains.
Classes
class BotFrameworkAdapter
class BotFrameworkAdapter extends BotAdapter implements BotFrameworkHttpAdapter, ConnectorClientBuilder, ExtendedUserTokenProvider, RequestHandler {}
Deprecated
Use
CloudAdapter
instead.
constructor
constructor(settings?: Partial<BotFrameworkAdapterSettings>);
Creates a new instance of the [BotFrameworkAdapter](xref:botbuilder.BotFrameworkAdapter) class.
Parameter settings
Optional. The settings to use for this adapter instance.
Remarks
If the
settings
parameter does not include [channelService](xref:botbuilder.BotFrameworkAdapterSettings.channelService) or [openIdMetadata](xref:botbuilder.BotFrameworkAdapterSettings.openIdMetadata) values, the constructor checks the process' environment variables for these values. These values may be set when a bot is provisioned on Azure and if so are required for the bot to work properly in the global cloud or in a national cloud.The [BotFrameworkAdapterSettings](xref:botbuilder.BotFrameworkAdapterSettings) class defines the available adapter settings.
property credentials
protected readonly credentials: AppCredentials;
property credentialsProvider
protected readonly credentialsProvider: SimpleCredentialProvider;
property isStreamingConnectionOpen
readonly isStreamingConnectionOpen: boolean;
Used in streaming contexts to check if the streaming connection is still open for the bot to send activities.
Returns
True if the streaming connection is open, otherwise false.
property settings
protected readonly settings: BotFrameworkAdapterSettings;
property TokenApiClientCredentialsKey
readonly TokenApiClientCredentialsKey: Symbol;
method authenticateRequest
protected authenticateRequest: ( request: Activity, authHeader: string) => Promise<void>;
Allows for the overriding of authentication in unit tests.
Parameter request
Received request.
Parameter authHeader
Received authentication header.
method buildCredentials
protected buildCredentials: ( appId: string, oAuthScope?: string) => Promise<AppCredentials>;
Parameter appId
The application id.
Parameter oAuthScope
The optional OAuth scope.
Returns
The app credentials to be used to acquire tokens.
Remarks
When building credentials for bot-to-bot communication, oAuthScope must be passed in.
method checkEmulatingOAuthCards
protected checkEmulatingOAuthCards: (context: TurnContext) => void;
Checks the environment and can set a flag to emulate OAuth cards.
Parameter context
The context object for the turn.
Remarks
Override this in a derived class to control how OAuth cards are emulated for unit testing.
method continueConversation
continueConversation: { ( reference: ConversationReference, logic: (context: TurnContext) => Promise<void> ): Promise<void>; ( reference: ConversationReference, oAuthScope: string, logic: (context: TurnContext) => Promise<void> ): Promise<void>;};
Asynchronously resumes a conversation with a user, possibly after some time has gone by.
Parameter reference
A reference to the conversation to continue.
Parameter oAuthScope
The intended recipient of any sent activities.
Parameter logic
The asynchronous method to call after the adapter middleware runs.
Remarks
This is often referred to as a _proactive notification_, the bot can proactively send a message to a conversation or user without waiting for an incoming message. For example, a bot can use this method to send notifications or coupons to a user.
To send a proactive message: 1. Save a copy of a [ConversationReference](xref:botframework-schema.ConversationReference) from an incoming activity. For example, you can store the conversation reference in a database. 1. Call this method to resume the conversation at a later time. Use the saved reference to access the conversation. 1. On success, the adapter generates a [TurnContext](xref:botbuilder-core.TurnContext) object and calls the
logic
function handler. Use thelogic
function to send the proactive message.To copy the reference from any incoming activity in the conversation, use the [TurnContext.getConversationReference](xref:botbuilder-core.TurnContext.getConversationReference) method.
This method is similar to the [processActivity](xref:botbuilder.BotFrameworkAdapter.processActivity) method. The adapter creates a [TurnContext](xref:botbuilder-core.TurnContext) and routes it through its middleware before calling the
logic
handler. The created activity will have a [type](xref:botframework-schema.Activity.type) of 'event' and a [name](xref:botframework-schema.Activity.name) of 'continueConversation'.For example:
server.post('/api/notifyUser', async (req, res) => {// Lookup previously saved conversation reference.const reference = await findReference(req.body.refId);// Proactively notify the user.if (reference) {await adapter.continueConversation(reference, async (context) => {await context.sendActivity(req.body.message);});res.send(200);} else {res.send(404);}});Asynchronously resumes a conversation with a user, possibly after some time has gone by.
Parameter reference
[ConversationReference](xref:botframework-schema.ConversationReference) of the conversation to continue.
Parameter oAuthScope
The intended recipient of any sent activities or the function to call to continue the conversation.
Parameter logic
Optional. The asynchronous method to call after the adapter middleware runs.
method createConnectorClient
createConnectorClient: (serviceUrl: string) => ConnectorClient;
Creates a connector client.
Parameter serviceUrl
The client's service URL.
Returns
The [ConnectorClient](xref:botbuilder-connector.ConnectorClient) instance.
Remarks
Override this in a derived class to create a mock connector client for unit testing.
method createConnectorClientWithIdentity
createConnectorClientWithIdentity: { (serviceUrl: string, identity: ClaimsIdentity): Promise<ConnectorClient>; ( serviceUrl: string, identity: ClaimsIdentity, audience: string ): Promise<ConnectorClient>;};
Create a ConnectorClient with a ClaimsIdentity.
Parameter serviceUrl
The client's service URL.
Parameter identity
ClaimsIdentity
Remarks
If the ClaimsIdentity contains the claims for a Skills request, create a ConnectorClient for use with Skills. Derives the correct audience from the ClaimsIdentity, or the instance's credentials property.
Create a ConnectorClient with a ClaimsIdentity and an explicit audience.
Parameter serviceUrl
The client's service URL.
Parameter identity
ClaimsIdentity
Parameter audience
The recipient of the ConnectorClient's messages. Normally the Bot Framework Channel Service or the AppId of another bot.
Remarks
If the trimmed audience is not a non-zero length string, the audience will be derived from the ClaimsIdentity or the instance's credentials property.
method createContext
protected createContext: (request: Activity) => TurnContext;
Creates a turn context.
Parameter request
An incoming request body.
Returns
A new [TurnContext](xref:botbuilder-core.TurnContext) instance.
Remarks
Override this in a derived class to modify how the adapter creates a turn context.
method createConversation
createConversation: { ( reference: ConversationReference, logic: (context: TurnContext) => Promise<void> ): Promise<void>; ( reference: ConversationReference, parameters: ConversationParameters, logic: (context: TurnContext) => Promise<void> ): Promise<void>;};
Asynchronously creates and starts a conversation with a user on a channel.
Parameter reference
A reference for the conversation to create.
Parameter logic
The asynchronous method to call after the adapter middleware runs.
Returns
{Promise} a promise representing the asynchronous operation
To use this method, you need both the bot's and the user's account information on a channel. The Bot Connector service supports the creating of group conversations; however, this method and most channels only support initiating a direct message (non-group) conversation.
To create and start a new conversation: 1. Get a copy of a [ConversationReference](xref:botframework-schema.ConversationReference) from an incoming activity. 1. Set the [user](xref:botframework-schema.ConversationReference.user) property to the [ChannelAccount](xref:botframework-schema.ChannelAccount) value for the intended recipient. 1. Call this method to request that the channel create a new conversation with the specified user. 1. On success, the adapter generates a turn context and calls the
logic
function handler.To get the initial reference, use the [TurnContext.getConversationReference](xref:botbuilder-core.TurnContext.getConversationReference) method on any incoming activity in the conversation.
If the channel establishes the conversation, the generated event activity's [conversation](xref:botframework-schema.Activity.conversation) property will contain the ID of the new conversation.
This method is similar to the [processActivity](xref:botbuilder.BotFrameworkAdapter.processActivity) method. The adapter creates a [TurnContext](xref:botbuilder-core.TurnContext) and routes it through middleware before calling the
logic
handler. The created activity will have a [type](xref:botframework-schema.Activity.type) of 'event' and a [name](xref:botframework-schema.Activity.name) of 'createConversation'.For example:
// Get group members conversation referenceconst reference = TurnContext.getConversationReference(context.activity);// ...// Start a new conversation with the userawait adapter.createConversation(reference, async (ctx) => {await ctx.sendActivity(`Hi (in private)`);});Asynchronously creates and starts a conversation with a user on a channel.
Parameter reference
A reference for the conversation to create.
Parameter parameters
Parameters used when creating the conversation
Parameter logic
The asynchronous method to call after the adapter middleware runs.
Returns
{Promise} a promise representing the asynchronous operation
method createTokenApiClient
protected createTokenApiClient: ( serviceUrl: string, oAuthAppCredentials?: CoreAppCredentials) => TokenApiClient;
Creates an OAuth API client.
Parameter serviceUrl
The client's service URL.
Parameter oAuthAppCredentials
AppCredentials for OAuth.
Remarks
Override this in a derived class to create a mock OAuth API client for unit testing.
method deleteActivity
deleteActivity: ( context: TurnContext, reference: ConversationReference) => Promise<void>;
Asynchronously deletes an existing activity.
This interface supports the framework and is not intended to be called directly for your code. Use [TurnContext.deleteActivity](xref:botbuilder-core.TurnContext.deleteActivity) to delete an activity from your bot code.
Parameter context
The context object for the turn.
Parameter reference
Conversation reference information for the activity to delete.
Remarks
Not all channels support this operation. For channels that don't, this call may throw an exception.
method deleteConversationMember
deleteConversationMember: ( context: TurnContext, memberId: string) => Promise<void>;
Asynchronously removes a member from the current conversation.
Parameter context
The context object for the turn.
Parameter memberId
The ID of the member to remove from the conversation.
Remarks
Remove a member's identity information from the conversation.
Not all channels support this operation. For channels that don't, this call may throw an exception.
method emulateOAuthCards
emulateOAuthCards: ( contextOrServiceUrl: TurnContext | string, emulate: boolean) => Promise<void>;
Asynchronously sends an emulated OAuth card for a channel.
This method supports the framework and is not intended to be called directly for your code.
Parameter contextOrServiceUrl
The URL of the emulator.
Parameter emulate
true
to send an emulated OAuth card to the emulator; orfalse
to not send the card.Remarks
When testing a bot in the Bot Framework Emulator, this method can emulate the OAuth card interaction.
method exchangeToken
exchangeToken: ( context: TurnContext, connectionName: string, userId: string, tokenExchangeRequest: TokenExchangeRequest, appCredentials?: CoreAppCredentials) => Promise<TokenResponse>;
Asynchronously Performs a token exchange operation such as for single sign-on.
Parameter context
Context for the current turn of conversation with the user.
Parameter connectionName
Name of the auth connection to use.
Parameter userId
The user id that will be associated with the token.
Parameter tokenExchangeRequest
The exchange request details, either a token to exchange or a uri to exchange.
Parameter appCredentials
Optional. The CoreAppCredentials for OAuth.
method getAadTokens
getAadTokens: { ( context: TurnContext, connectionName: string, resourceUrls: string[] ): Promise<{ [propertyName: string]: TokenResponse }>; ( context: TurnContext, connectionName: string, resourceUrls: string[], oAuthAppCredentials?: CoreAppCredentials ): Promise<{ [propertyName: string]: TokenResponse }>;};
Asynchronously signs out the user from the token server.
Parameter context
The context object for the turn.
Parameter connectionName
The name of the auth connection to use.
Parameter resourceUrls
The list of resource URLs to retrieve tokens for.
Parameter oAuthAppCredentials
AppCredentials for OAuth.
Returns
A map of the [TokenResponse](xref:botframework-schema.TokenResponse) objects by resource URL.
method getActivityMembers
getActivityMembers: ( context: TurnContext, activityId?: string) => Promise<ChannelAccount[]>;
Asynchronously lists the members of a given activity.
Parameter context
The context object for the turn.
Parameter activityId
Optional. The ID of the activity to get the members of. If not specified, the current activity ID is used.
Returns
An array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for the users involved in a given activity.
Remarks
Returns an array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for the users involved in a given activity.
This is different from [getConversationMembers](xref:botbuilder.BotFrameworkAdapter.getConversationMembers) in that it will return only those users directly involved in the activity, not all members of the conversation.
method getConversationMembers
getConversationMembers: (context: TurnContext) => Promise<ChannelAccount[]>;
Asynchronously lists the members of the current conversation.
Parameter context
The context object for the turn.
Returns
An array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for all users currently involved in a conversation.
Remarks
Returns an array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for all users currently involved in a conversation.
This is different from [getActivityMembers](xref:botbuilder.BotFrameworkAdapter.getActivityMembers) in that it will return all members of the conversation, not just those directly involved in a specific activity.
method getConversations
getConversations: ( contextOrServiceUrl: TurnContext | string, continuationToken?: string) => Promise<ConversationsResult>;
For the specified channel, asynchronously gets a page of the conversations in which this bot has participated.
Parameter contextOrServiceUrl
The URL of the channel server to query or a [TurnContext](xref:botbuilder-core.TurnContext) object from a conversation on the channel.
Parameter continuationToken
Optional. The continuation token from the previous page of results. Omit this parameter or use
undefined
to retrieve the first page of results.Returns
A [ConversationsResult](xref:botframework-schema.ConversationsResult) object containing a page of results and a continuation token.
Remarks
The the return value's [conversations](xref:botframework-schema.ConversationsResult.conversations) property contains a page of [ConversationMembers](xref:botframework-schema.ConversationMembers) objects. Each object's [id](xref:botframework-schema.ConversationMembers.id) is the ID of a conversation in which the bot has participated on this channel. This method can be called from outside the context of a conversation, as only the bot's service URL and credentials are required.
The channel batches results in pages. If the result's [continuationToken](xref:botframework-schema.ConversationsResult.continuationToken) property is not empty, then there are more pages to get. Use the returned token to get the next page of results. If the
contextOrServiceUrl
parameter is a [TurnContext](xref:botbuilder-core.TurnContext), the URL of the channel server is retrieved fromcontextOrServiceUrl
.[activity](xref:botbuilder-core.TurnContext.activity).[serviceUrl](xref:botframework-schema.Activity.serviceUrl).
method getSignInLink
getSignInLink: { ( context: TurnContext, connectionName: string, oAuthAppCredentials?: AppCredentials, userId?: string, finalRedirect?: string ): Promise<string>; ( context: TurnContext, connectionName: string, oAuthAppCredentials?: CoreAppCredentials, userId?: string, finalRedirect?: string ): Promise<string>;};
Asynchronously gets a sign-in link from the token server that can be sent as part of a [SigninCard](xref:botframework-schema.SigninCard).
Parameter context
The context object for the turn.
Parameter connectionName
The name of the auth connection to use.
Parameter oAuthAppCredentials
AppCredentials for OAuth.
Parameter userId
The user id that will be associated with the token.
Parameter finalRedirect
The final URL that the OAuth flow will redirect to.
method getSignInResource
getSignInResource: ( context: TurnContext, connectionName: string, userId?: string, finalRedirect?: string, appCredentials?: CoreAppCredentials) => Promise<SignInUrlResponse>;
Asynchronously Get the raw signin resource to be sent to the user for signin.
Parameter context
The context object for the turn.
Parameter connectionName
The name of the auth connection to use.
Parameter userId
The user id that will be associated with the token.
Parameter finalRedirect
The final URL that the OAuth flow will redirect to.
Parameter appCredentials
Optional. The CoreAppCredentials for OAuth.
Returns
The [BotSignInGetSignInResourceResponse](xref:botframework-connector.BotSignInGetSignInResourceResponse) object.
method getTokenStatus
getTokenStatus: { (context: TurnContext, userId?: string, includeFilter?: string): Promise< TokenStatus[] >; ( context: TurnContext, userId?: string, includeFilter?: string, oAuthAppCredentials?: CoreAppCredentials ): Promise<TokenStatus[]>;};
Asynchronously retrieves the token status for each configured connection for the given user.
Parameter context
The context object for the turn.
Parameter userId
Optional. If present, the ID of the user to retrieve the token status for. Otherwise, the ID of the user who sent the current activity is used.
Parameter includeFilter
Optional. A comma-separated list of connection's to include. If present, the
includeFilter
parameter limits the tokens this method returns.Parameter oAuthAppCredentials
AppCredentials for OAuth.
Returns
The [TokenStatus](xref:botframework-connector.TokenStatus) objects retrieved.
method getUserToken
getUserToken: { ( context: TurnContext, connectionName: string, magicCode?: string ): Promise<TokenResponse>; ( context: TurnContext, connectionName: string, magicCode?: string, oAuthAppCredentials?: CoreAppCredentials ): Promise<TokenResponse>;};
Asynchronously attempts to retrieve the token for a user that's in a login flow.
Parameter context
The context object for the turn.
Parameter connectionName
The name of the auth connection to use.
Parameter magicCode
Optional. The validation code the user entered.
Parameter oAuthAppCredentials
AppCredentials for OAuth.
Returns
A [TokenResponse](xref:botframework-schema.TokenResponse) object that contains the user token.
method oauthApiUrl
protected oauthApiUrl: (contextOrServiceUrl: TurnContext | string) => string;
Gets the OAuth API endpoint.
Parameter contextOrServiceUrl
The URL of the channel server to query or a [TurnContext](xref:botbuilder-core.TurnContext). For a turn context, the context's [activity](xref:botbuilder-core.TurnContext.activity).[serviceUrl](xref:botframework-schema.Activity.serviceUrl) is used for the URL.
Returns
The endpoint used for the API requests.
Remarks
Override this in a derived class to create a mock OAuth API endpoint for unit testing.
method process
process: { ( req: Request, res: Response, logic: (context: TurnContext) => Promise<void> ): Promise<void>; ( req: Request<Record<string, unknown>, Record<string, string | string[]>>, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise<void> ): Promise<void>;};
Process a web request by applying a logic function.
Parameter req
An incoming HTTP [Request](xref:botbuilder.Request)
Parameter res
The corresponding HTTP [Response](xref:botbuilder.Response)
Parameter logic
The logic function to apply
Returns
a promise representing the asynchronous operation.
Handle a web socket connection by applying a logic function to each streaming request.
Parameter req
An incoming HTTP [Request](xref:botbuilder.Request)
Parameter socket
The corresponding [INodeSocket](xref:botframework-streaming.INodeSocket)
Parameter head
The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer)
Parameter logic
The logic function to apply
Returns
a promise representing the asynchronous operation.
method processActivity
processActivity: ( req: WebRequest, res: WebResponse, logic: (context: TurnContext) => Promise<any>) => Promise<void>;
Asynchronously creates a turn context and runs the middleware pipeline for an incoming activity.
Parameter req
An Express or Restify style request object.
Parameter res
An Express or Restify style response object.
Parameter logic
The function to call at the end of the middleware pipeline.
Remarks
This is the main way a bot receives incoming messages and defines a turn in the conversation. This method:
1. Parses and authenticates an incoming request. - The activity is read from the body of the incoming request. An error will be returned if the activity can't be parsed. - The identity of the sender is authenticated as either the Emulator or a valid Microsoft server, using the bot's
appId
andappPassword
. The request is rejected if the sender's identity is not verified. 1. Creates a [TurnContext](xref:botbuilder-core.TurnContext) object for the received activity. - This object is wrapped with a [revocable proxy](https://www.ecma-international.org/ecma-262/6.0/#sec-proxy.revocable). - When this method completes, the proxy is revoked. 1. Sends the turn context through the adapter's middleware pipeline. 1. Sends the turn context to thelogic
function. - The bot may perform additional routing or processing at this time. Returning a promise (or providing anasync
handler) will cause the adapter to wait for any asynchronous operations to complete. - After thelogic
function completes, the promise chain set up by the middleware is resolved.> [!TIP] > If you see the error
TypeError: Cannot perform 'set' on a proxy that has been revoked
> in your bot's console output, the likely cause is that an async function was used > without using theawait
keyword. Make sure all async functions use await!Middleware can _short circuit_ a turn. When this happens, subsequent middleware and the
logic
function is not called; however, all middleware prior to this point still run to completion. For more information about the middleware pipeline, see the [how bots work](https://docs.microsoft.com/azure/bot-service/bot-builder-basics) and [middleware](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-middleware) articles. Use the adapter's [use](xref:botbuilder-core.BotAdapter.use) method to add middleware to the adapter.For example:
server.post('/api/messages', (req, res) => {// Route received request to adapter for processingadapter.processActivity(req, res, async (context) => {// Process any messages receivedif (context.activity.type === ActivityTypes.Message) {await context.sendActivity(`Hello World`);}});});
method processActivityDirect
processActivityDirect: ( activity: Activity, logic: (context: TurnContext) => Promise<any>) => Promise<void>;
Asynchronously creates a turn context and runs the middleware pipeline for an incoming activity.
Use [CloudAdapter.processActivityDirect] instead.
Parameter activity
The activity to process.
Parameter logic
The function to call at the end of the middleware pipeline.
Remarks
This is the main way a bot receives incoming messages and defines a turn in the conversation. This method:
1. Creates a [TurnContext](xref:botbuilder-core.TurnContext) object for the received activity. - This object is wrapped with a [revocable proxy](https://www.ecma-international.org/ecma-262/6.0/#sec-proxy.revocable). - When this method completes, the proxy is revoked. 1. Sends the turn context through the adapter's middleware pipeline. 1. Sends the turn context to the
logic
function. - The bot may perform additional routing or processing at this time. Returning a promise (or providing anasync
handler) will cause the adapter to wait for any asynchronous operations to complete. - After thelogic
function completes, the promise chain set up by the middleware is resolved.Middleware can _short circuit_ a turn. When this happens, subsequent middleware and the
logic
function is not called; however, all middleware prior to this point still run to completion. For more information about the middleware pipeline, see the [how bots work](https://docs.microsoft.com/azure/bot-service/bot-builder-basics) and [middleware](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-middleware) articles. Use the adapter's [use](xref:botbuilder-core.BotAdapter.use) method to add middleware to the adapter.
method processRequest
processRequest: (request: IReceiveRequest) => Promise<StreamingResponse>;
Checks the validity of the request and attempts to map it the correct virtual endpoint, then generates and returns a response if appropriate.
Parameter request
A ReceiveRequest from the connected channel.
Returns
A response created by the BotAdapter to be sent to the client that originated the request.
method sendActivities
sendActivities: ( context: TurnContext, activities: Partial<Activity>[]) => Promise<ResourceResponse[]>;
Asynchronously sends a set of outgoing activities to a channel server.
This method supports the framework and is not intended to be called directly for your code. Use the turn context's [sendActivity](xref:botbuilder-core.TurnContext.sendActivity) or [sendActivities](xref:botbuilder-core.TurnContext.sendActivities) method from your bot code.
Parameter context
The context object for the turn.
Parameter activities
The activities to send.
Returns
An array of [ResourceResponse](xref:)
Remarks
The activities will be sent one after another in the order in which they're received. A response object will be returned for each sent activity. For
message
activities this will contain the ID of the delivered message.
method signOutUser
signOutUser: { ( context: TurnContext, connectionName?: string, userId?: string ): Promise<void>; ( context: TurnContext, connectionName?: string, userId?: string, oAuthAppCredentials?: CoreAppCredentials ): Promise<void>;};
Asynchronously signs out the user from the token server.
Parameter context
The context object for the turn.
Parameter connectionName
The name of the auth connection to use.
Parameter userId
The ID of user to sign out.
Parameter oAuthAppCredentials
AppCredentials for OAuth.
method updateActivity
updateActivity: ( context: TurnContext, activity: Activity) => Promise<ResourceResponse | void>;
Asynchronously replaces a previous activity with an updated version.
This interface supports the framework and is not intended to be called directly for your code. Use [TurnContext.updateActivity](xref:botbuilder-core.TurnContext.updateActivity) to update an activity from your bot code.
Parameter context
The context object for the turn.
Parameter activity
The updated version of the activity to replace.
Returns
A
Promise
representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.Remarks
Not all channels support this operation. For channels that don't, this call may throw an exception.
method useNamedPipe
useNamedPipe: ( logic: (context: TurnContext) => Promise<any>, pipeName?: string, retryCount?: number, onListen?: () => void) => Promise<void>;
Connects the handler to a Named Pipe server and begins listening for incoming requests.
Parameter logic
The logic that will handle incoming requests.
Parameter pipeName
The name of the named pipe to use when creating the server.
Parameter retryCount
Number of times to attempt to bind incoming and outgoing pipe
Parameter onListen
Optional callback that fires once when server is listening on both incoming and outgoing pipe
method useWebSocket
useWebSocket: ( req: WebRequest, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise<any>) => Promise<void>;
Process the initial request to establish a long lived connection via a streaming server.
Parameter req
The connection request.
Parameter socket
The raw socket connection between the bot (server) and channel/caller (client).
Parameter head
The first packet of the upgraded stream.
Parameter logic
The logic that handles incoming streaming requests for the lifetime of the WebSocket connection.
class BotFrameworkHttpClient
class BotFrameworkHttpClient implements BotFrameworkClient {}
Deprecated
Use
BotFrameworkAuthentication.createBotFrameworkClient()
to obtain a client and perform the operations that were accomplished throughBotFrameworkHttpClient
. HttpClient for calling skills from a Node.js BotBuilder V4 SDK bot.
constructor
constructor(credentialProvider: ICredentialProvider, channelService?: string);
Creates a new instance of the [BotFrameworkHttpClient](xref:botbuilder.BotFrameworkHttpClient) class
Parameter credentialProvider
An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider).
Parameter channelService
Optional. The channel service.
property channelService
protected readonly channelService: string;
method buildCredentials
protected buildCredentials: ( appId: string, oAuthScope?: string) => Promise<AppCredentials>;
Logic to build an [AppCredentials](xref:botframework-connector.AppCredentials) to be used to acquire tokens for this
HttpClient
.Parameter appId
The application id.
Parameter oAuthScope
Optional. The OAuth scope.
Returns
The app credentials to be used to acquire tokens.
method postActivity
postActivity: <T = any>( fromBotId: string, toBotId: string, toUrl: string, serviceUrl: string, conversationId: string, activity: Activity) => Promise<InvokeResponse<T>>;
Forwards an activity to another bot.
Parameter fromBotId
The MicrosoftAppId of the bot sending the activity.
Parameter toBotId
The MicrosoftAppId of the bot receiving the activity.
Parameter toUrl
The URL of the bot receiving the activity.
Parameter serviceUrl
The callback Url for the skill host.
Parameter conversationId
A conversation ID to use for the conversation with the skill.
Parameter activity
Activity to forward.
Returns
{Promise<InvokeResponse>} A promise representing the asynchronous operation.
Remarks
T The type of body in the InvokeResponse.
class ChannelServiceHandler
class ChannelServiceHandler extends ChannelServiceHandlerBase {}
Deprecated
Use
CloudChannelServiceHandler
instead. The ChannelServiceHandler implements API to forward activity to a skill and implements routing ChannelAPI calls from the Skill up through the bot/adapter.
constructor
constructor( credentialProvider: ICredentialProvider, authConfig: AuthenticationConfiguration, channelService?: string);
Initializes a new instance of the ChannelServiceHandler class, using a credential provider.
Parameter credentialProvider
The credential provider.
Parameter authConfig
The authentication configuration.
Parameter channelService
A string representing the channel provider.
property channelService
protected readonly channelService: string;
method authenticate
protected authenticate: (authHeader: string) => Promise<ClaimsIdentity>;
class ChannelServiceHandlerBase
abstract class ChannelServiceHandlerBase {}
The ChannelServiceHandlerBase implements API to forward activity to a skill and implements routing ChannelAPI calls from the Skill up through the bot/adapter.
method authenticate
protected abstract authenticate: (authHeader: string) => Promise<ClaimsIdentity>;
Helper to authenticate the header token and extract the claims.
Parameter authHeader
HTTP authorization header
Returns
a promise resolving to the authorization header claims
method handleCreateConversation
handleCreateConversation: ( authHeader: string, parameters: ConversationParameters) => Promise<ConversationResourceResponse>;
Creates a new Conversation.
Parameter authHeader
The authentication header.
Parameter parameters
[ConversationParameters](xref:botbuilder-core.ConversationParameters) to create the conversation from.
Returns
A
Promise
representation for the operation.
method handleDeleteActivity
handleDeleteActivity: ( authHeader: string, conversationId: string, activityId: string) => Promise<void>;
Deletes an existing [Activity](xref:botframework-schema.Activity).
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter activityId
The activity Id to delete.
method handleDeleteConversationMember
handleDeleteConversationMember: ( authHeader: string, conversationId: string, memberId: string) => Promise<void>;
Deletes a member from a conversation.
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter memberId
Id of the member to delete from this conversation.
method handleGetActivityMembers
handleGetActivityMembers: ( authHeader: string, conversationId: string, activityId: string) => Promise<ChannelAccount[]>;
Enumerates the members of an [Activity](xref:botframework-schema.Activity).
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter activityId
The activity Id.
Returns
The enumerated [ChannelAccount](xref:botframework-schema.ChannelAccount) list.
method handleGetConversationMember
handleGetConversationMember: ( authHeader: string, userId: string, conversationId: string) => Promise<ChannelAccount>;
Gets the account of a single conversation member.
Parameter authHeader
The authentication header.
Parameter userId
The user Id.
Parameter conversationId
The conversation Id.
Returns
The [ChannelAccount](xref:botframework-schema.ChannelAccount) for the provided user id.
method handleGetConversationMembers
handleGetConversationMembers: ( authHeader: string, conversationId: string) => Promise<ChannelAccount[]>;
Enumerates the members of a conversation.
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Returns
The enumerated [ChannelAccount](xref:botframework-schema.ChannelAccount) list.
method handleGetConversationPagedMembers
handleGetConversationPagedMembers: ( authHeader: string, conversationId: string, pageSize?: number, continuationToken?: string) => Promise<PagedMembersResult>;
Enumerates the members of a conversation one page at a time.
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter pageSize
Suggested page size.
Parameter continuationToken
A continuation token.
Returns
A
Promise
representing the [PagedMembersResult](xref:botframework-schema.PagedMembersResult) for the operation.
method handleGetConversations
handleGetConversations: ( authHeader: string, conversationId: string, continuationToken?: string) => Promise<ConversationsResult>;
Lists the Conversations in which the bot has participated.
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter continuationToken
A skip or continuation token.
Returns
A
Promise
representation for the operation.
method handleReplyToActivity
handleReplyToActivity: ( authHeader: string, conversationId: string, activityId: string, activity: Activity) => Promise<ResourceResponse>;
Sends a reply to an [Activity](xref:botframework-schema.Activity).
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter activityId
The activity Id the reply is to.
Parameter activity
The [Activity](xref:botframework-schema.Activity) to send.
Returns
A
Promise
representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
method handleSendConversationHistory
handleSendConversationHistory: ( authHeader: string, conversationId: string, transcript: Transcript) => Promise<ResourceResponse>;
Uploads the historic activities of the conversation.
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter transcript
[Transcript](xref:botframework-schema.Transcript) of activities.
Returns
A
Promise
representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
method handleSendToConversation
handleSendToConversation: ( authHeader: string, conversationId: string, activity: Activity) => Promise<ResourceResponse>;
Sends an [Activity](xref:botframework-schema.Activity) to the end of a conversation.
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter activity
The [Activity](xref:botframework-schema.Activity) to send.
Returns
A
Promise
representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
method handleUpdateActivity
handleUpdateActivity: ( authHeader: string, conversationId: string, activityId: string, activity: Activity) => Promise<ResourceResponse>;
Edits a previously sent existing [Activity](xref:botframework-schema.Activity).
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter activityId
The activity Id to update.
Parameter activity
The replacement [Activity](xref:botframework-schema.Activity).
Returns
A
Promise
representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
method handleUploadAttachment
handleUploadAttachment: ( authHeader: string, conversationId: string, attachmentUpload: AttachmentData) => Promise<ResourceResponse>;
Stores data in a compliant store when dealing with enterprises.
Parameter authHeader
The authentication header.
Parameter conversationId
The conversation Id.
Parameter attachmentUpload
[AttachmentData](xref:botframework-schema.AttachmentData).
Returns
A
Promise
representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
method onCreateConversation
protected onCreateConversation: ( _claimsIdentity: ClaimsIdentity, _parameters: ConversationParameters) => Promise<ConversationResourceResponse>;
CreateConversation() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _parameters
Parameters to create the conversation from.
Remarks
Create a new Conversation.
POST to this method with a * Bot being the bot creating the conversation * IsGroup set to true if this is not a direct message (default is false) * Array containing the members to include in the conversation
The return value is a ResourceResponse which contains a conversation id which is suitable for use in the message payload and REST API uris.
Most channels only support the semantics of bots initiating a direct message conversation.
method onDeleteActivity
protected onDeleteActivity: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string) => Promise<void>;
DeleteActivity() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _activityId
activityId to delete.
Remarks
Delete an existing activity.
Some channels allow you to delete an existing activity, and if successful this method will remove the specified activity.
method onDeleteConversationMember
protected onDeleteConversationMember: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _memberId: string) => Promise<void>;
DeleteConversationMember() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _memberId
ID of the member to delete from this conversation.
Remarks
Deletes a member from a conversation.
This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member of the conversation, the conversation will also be deleted.
method onGetActivityMembers
protected onGetActivityMembers: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string) => Promise<ChannelAccount[]>;
GetActivityMembers() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _activityId
Activity ID.
Remarks
Enumerate the members of an activity.
This REST API takes a ConversationId and a ActivityId, returning an array of ChannelAccount objects representing the members of the particular activity in the conversation.
method onGetConversationMember
protected onGetConversationMember: ( _claimsIdentity: ClaimsIdentity, _userId: string, _conversationId: string) => Promise<ChannelAccount>;
getConversationMember() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _userId
User ID.
Parameter _conversationId
Conversation ID.
Remarks
Get the account of a single conversation member.
This REST API takes a ConversationId and UserId and returns the ChannelAccount object representing the member of the conversation.
method onGetConversationMembers
protected onGetConversationMembers: ( _claimsIdentity: ClaimsIdentity, _conversationId: string) => Promise<ChannelAccount[]>;
getConversationMembers() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Remarks
Enumerate the members of a conversation.
This REST API takes a ConversationId and returns an array of ChannelAccount objects representing the members of the conversation.
method onGetConversationPagedMembers
protected onGetConversationPagedMembers: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _pageSize?: number, _continuationToken?: string) => Promise<PagedMembersResult>;
getConversationPagedMembers() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _pageSize
Suggested page size.
Parameter _continuationToken
Continuation Token.
Remarks
Enumerate the members of a conversation one page at a time.
This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members of the conversation and a continuation token that can be used to get more values.
One page of ChannelAccounts records are returned with each call. The number of records in a page may vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no additional results the response will not contain a continuation token. If there are no members in the conversation the Members will be empty or not present in the response.
A response to a request that has a continuation token from a prior request may rarely return members from a previous request.
method onGetConversations
protected onGetConversations: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _continuationToken?: string) => Promise<ConversationsResult>;
onGetConversations() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _continuationToken
Skip or continuation token.
Remarks
List the Conversations in which this bot has participated.
GET from this method with a skip token
The return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. If the skip token is not empty, then there are further values to be returned. Call this method again with the returned token to get more values.
Each ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that describe the members of the conversation.
method onReplyToActivity
protected onReplyToActivity: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string, _activity: Activity) => Promise<ResourceResponse>;
ReplyToActivity() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _activityId
activityId the reply is to (OPTIONAL).
Parameter _activity
Activity to send.
Remarks
This method allows you to reply to an activity.
This is slightly different from SendToConversation(). * SendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.
Use ReplyToActivity when replying to a specific activity in the conversation.
Use SendToConversation in all other cases.
method onSendConversationHistory
protected onSendConversationHistory: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _transcript: Transcript) => Promise<ResourceResponse>;
SendConversationHistory() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _transcript
Transcript of activities.
Remarks
This method allows you to upload the historic activities to the conversation.
Sender must ensure that the historic activities have unique ids and appropriate timestamps. The ids are used by the client to deal with duplicate activities and the timestamps are used by the client to render the activities in the right order.
method onSendToConversation
protected onSendToConversation: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _activity: Activity) => Promise<ResourceResponse>;
SendToConversation() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation identifier
Parameter _activity
Activity to send
Remarks
This method allows you to send an activity to the end of a conversation. This is slightly different from ReplyToActivity(). * SendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.
Use ReplyToActivity when replying to a specific activity in the conversation.
Use SendToConversation in all other cases.
method onUpdateActivity
protected onUpdateActivity: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string, _activity: Activity) => Promise<ResourceResponse>;
UpdateActivity() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _activityId
activityId to update.
Parameter _activity
replacement Activity.
Remarks
Edit an existing activity.
Some channels allow you to edit an existing activity to reflect the new state of a bot conversation.
For example, you can remove buttons after someone has clicked "Approve" button.
method onUploadAttachment
protected onUploadAttachment: ( _claimsIdentity: ClaimsIdentity, _conversationId: string, _attachmentUpload: AttachmentData) => Promise<ResourceResponse>;
UploadAttachment() API for Skill.
Parameter _claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter _conversationId
Conversation ID.
Parameter _attachmentUpload
Attachment data.
Remarks
Upload an attachment directly into a channel's blob storage.
This is useful because it allows you to store data in a compliant store when dealing with enterprises.
The response is a ResourceResponse which contains an AttachmentId which is suitable for using with the attachments API.
class ChannelServiceRoutes
class ChannelServiceRoutes {}
Routes the API calls with the ChannelServiceHandler methods.
constructor
constructor(channelServiceHandler: ChannelServiceHandlerBase);
Parameter channelServiceHandler
The channel service handler.
method register
register: (server: WebServer, basePath?: string) => void;
Registers all Channel Service paths on the provided WebServer.
Parameter server
WebServer
Parameter basePath
Optional basePath which is appended before the service's REST API is configured on the WebServer.
class CloudAdapter
class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAdapter {}
An adapter that implements the Bot Framework Protocol and can be hosted in different cloud environmens both public and private.
constructor
constructor(botFrameworkAuthentication?: BotFrameworkAuthentication);
Initializes a new instance of the [CloudAdapter](xref:botbuilder:CloudAdapter) class.
Parameter botFrameworkAuthentication
Optional [BotFrameworkAuthentication](xref:botframework-connector.BotFrameworkAuthentication) instance
method connectNamedPipe
connectNamedPipe: ( pipeName: string, logic: (context: TurnContext) => Promise<void>, appId: string, audience: string, callerId?: string, retryCount?: number) => Promise<void>;
Used to connect the adapter to a named pipe.
Parameter pipeName
Pipe name to connect to (note: yields two named pipe servers by appending ".incoming" and ".outgoing" to this name)
Parameter logic
The logic function to call for resulting bot turns.
Parameter appId
The Bot application ID
Parameter audience
The audience to use for outbound communication. The will vary by cloud environment.
Parameter callerId
Optional, the caller ID
Parameter retryCount
Optional, the number of times to retry a failed connection (defaults to 7)
method process
process: { ( req: Request, res: Response, logic: (context: TurnContext) => Promise<void> ): Promise<void>; ( req: Request<Record<string, unknown>, Record<string, string | string[]>>, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise<void> ): Promise<void>;};
Process a web request by applying a logic function.
Parameter req
An incoming HTTP [Request](xref:botbuilder.Request)
Parameter req
The corresponding HTTP [Response](xref:botbuilder.Response)
Parameter logic
The logic function to apply
Returns
a promise representing the asynchronous operation.
Handle a web socket connection by applying a logic function to each streaming request.
Parameter req
An incoming HTTP [Request](xref:botbuilder.Request)
Parameter socket
The corresponding [INodeSocket](xref:botframework-streaming.INodeSocket)
Parameter head
The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer)
Parameter logic
The logic function to apply
Returns
a promise representing the asynchronous operation.
method processActivityDirect
processActivityDirect: ( authorization: string | AuthenticateRequestResult, activity: Activity, logic: (context: TurnContext) => Promise<void>) => Promise<void>;
Asynchronously process an activity running the provided logic function.
Parameter authorization
The authorization header in the format: "Bearer [longString]" or the AuthenticateRequestResult for this turn.
Parameter activity
The activity to process.
Parameter logic
The logic function to apply.
Returns
a promise representing the asynchronous operation.
class CloudSkillHandler
class CloudSkillHandler extends CloudChannelServiceHandler {}
A Bot Framework Handler for skills.
constructor
constructor( adapter: BotAdapter, logic: (context: TurnContext) => Promise<void>, conversationIdFactory: SkillConversationIdFactoryBase, auth: BotFrameworkAuthentication);
Initializes a new instance of the CloudSkillHandler class.
Parameter adapter
An instance of the BotAdapter that will handle the request.
Parameter logic
The Bot logic function
Parameter conversationIdFactory
A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot.
Parameter auth
Bot Framework Authentication to use
property SkillConversationReferenceKey
readonly SkillConversationReferenceKey: Symbol;
Used to access the CovnersationReference sent from the Skill to the Parent.
method onDeleteActivity
protected onDeleteActivity: ( claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string) => Promise<void>;
DeleteActivity() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activityId
activityId to delete.
Returns
a promise representing the async operation
Remarks
Delete an existing activity.
Some channels allow you to delete an existing activity, and if successful this method will remove the specified activity.
method onGetConversationMember
protected onGetConversationMember: ( claimsIdentity: ClaimsIdentity, userId: string, conversationId: string) => Promise<ChannelAccount>;
getConversationMember() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter userId
User ID.
Parameter conversationId
Conversation ID.
Returns
The ChannelAccount object representing the member of the conversation.
Remarks
Get the account of a single conversation member.
This REST API takes a ConversationId and UserId and returns the ChannelAccount object representing the member of the conversation.
method onReplyToActivity
protected onReplyToActivity: ( claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, activity: Activity) => Promise<ResourceResponse>;
replyToActivity() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activityId
activityId the reply is to.
Parameter activity
Activity to send.
Returns
A Promise with a ResourceResponse.
Remarks
This method allows you to reply to an activity.
This is slightly different from sendToConversation(). * sendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. * replyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, replyToActivity falls back to sendToConversation.
Use replyToActivity when replying to a specific activity in the conversation.
Use sendToConversation in all other cases.
method onSendToConversation
protected onSendToConversation: ( claimsIdentity: ClaimsIdentity, conversationId: string, activity: Activity) => Promise<ResourceResponse>;
sendToConversation() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activity
Activity to send.
Returns
A Promise with a ResourceResponse.
Remarks
This method allows you to send an activity to the end of a conversation.
This is slightly different from replyToActivity(). * sendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. * replyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, replyToActivity falls back to sendToConversation.
Use replyToActivity when replying to a specific activity in the conversation.
Use sendToConversation in all other cases.
method onUpdateActivity
protected onUpdateActivity: ( claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, activity: Activity) => Promise<ResourceResponse>;
UpdateActivity() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activityId
activityId to update.
Parameter activity
replacement Activity.
Returns
a promise resolving to the underlying resource response
Remarks
Edit an existing activity.
Some channels allow you to edit an existing activity to reflect the new state of a bot conversation.
For example, you can remove buttons after someone has clicked "Approve" button.
class EventFactory
class EventFactory {}
Contains utility methods for creating various event types.
method createHandoffInitiation
static createHandoffInitiation: <T = unknown>( context: TurnContext, handoffContext: T, transcript?: Transcript) => Activity;
Create handoff initiation event.
Parameter context
The context object for the turn.
Parameter handoffContext
Agent hub-specific context.
Parameter transcript
Transcript of the conversation.
Returns
The handoff event activity.
method createHandoffStatus
static createHandoffStatus: ( conversation: ConversationAccount, state: string, message?: string) => Activity;
Create handoff status event.
Parameter conversation
Conversation being handed over.
Parameter state
State, possible values are: "accepted", "failed", "completed".
Parameter message
Additional message for failed handoff.
Returns
The handoff event activity.
class FileTranscriptStore
class FileTranscriptStore implements TranscriptStore {}
The file transcript store stores transcripts in file system with each activity as a file.
Remarks
This class provides an interface to log all incoming and outgoing activities to the filesystem. It implements the features necessary to work alongside the TranscriptLoggerMiddleware plugin. When used in concert, your bot will automatically log all conversations.
Below is the boilerplate code needed to use this in your app:
const { FileTranscriptStore, TranscriptLoggerMiddleware } = require('botbuilder');adapter.use(new TranscriptLoggerMiddleware(new FileTranscriptStore(__dirname + '/transcripts/')));
constructor
constructor(folder: string);
Creates an instance of FileTranscriptStore.
Parameter folder
Root folder where transcript will be stored.
method deleteTranscript
deleteTranscript: (channelId: string, conversationId: string) => Promise<void>;
Delete a conversation and all of it's activities.
Parameter channelId
Channel Id where conversation took place.
Parameter conversationId
Id of the conversation to delete.
Returns
{Promise} A promise representing the asynchronous operation.
method getTranscriptActivities
getTranscriptActivities: ( channelId: string, conversationId: string, continuationToken?: string, startDate?: Date) => Promise<PagedResult<Activity>>;
Get all activities associated with a conversation id (aka get the transcript).
Parameter channelId
Channel Id.
Parameter conversationId
Conversation Id.
Parameter continuationToken
(Optional) Continuation token to page through results.
Parameter startDate
(Optional) Earliest time to include.
Returns
{Promise<PagedResult>} PagedResult of activities.
method listTranscripts
listTranscripts: ( channelId: string, continuationToken?: string) => Promise<PagedResult<TranscriptInfo>>;
List all the logged conversations for a given channelId.
Parameter channelId
Channel Id.
Parameter continuationToken
(Optional) Continuation token to page through results.
Returns
{Promise<PagedResult>} PagedResult of transcripts.
method logActivity
logActivity: (activity: Activity) => Promise<void>;
Log an activity to the transcript.
Parameter activity
Activity being logged.
Returns
{Promise} a promise representing the asynchronous operation.
class HandoffEventNames
class HandoffEventNames {}
Defines values for handoff event names.
property HandoffStatus
static readonly HandoffStatus: string;
property InitiateHandoff
static readonly InitiateHandoff: string;
class InspectionMiddleware
class InspectionMiddleware extends InterceptionMiddleware {}
InspectionMiddleware for emulator inspection of runtime Activities and BotState.
Remarks
InspectionMiddleware for emulator inspection of runtime Activities and BotState.
Deprecated
This class will be removed in a future version of the framework.
constructor
constructor( inspectionState: InspectionState, userState?: UserState, conversationState?: ConversationState, credentials?: MicrosoftAppCredentials);
Create the Inspection middleware for sending trace activities out to an emulator session
Parameter inspectionState
A state management object for inspection state.
Parameter userState
A state management object for user state.
Parameter conversationState
A state management object for conversation state.
Parameter credentials
The authentication credentials.
method inbound
protected inbound: ( turnContext: TurnContext, traceActivity: Activity) => Promise<any>;
Processes inbound activities.
Parameter turnContext
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter traceActivity
The trace activity.
Returns
{Promise} A promise representing the asynchronous operation.
method outbound
protected outbound: ( turnContext: TurnContext, traceActivities: Partial<Activity>[]) => Promise<any>;
Processes outbound activities.
Parameter turnContext
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter traceActivities
A collection of trace activities.
method processCommand
processCommand: (turnContext: TurnContext) => Promise<any>;
Indentifies open and attach commands and calls the appropriate method.
Parameter turnContext
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Returns
True if the command is open or attached, otherwise false.
method traceState
protected traceState: (turnContext: TurnContext) => Promise<any>;
Processes the state management object.
Parameter turnContext
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
class InspectionState
class InspectionState extends BotState {}
InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState.
Remarks
InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState.
Deprecated
This class will be removed in a future version of the framework.
constructor
constructor(storage: Storage);
Creates a new instance of the [InspectionState](xref:botbuilder.InspectionState) class.
Parameter storage
The [Storage](xref:botbuilder-core.Storage) layer this state management object will use to store and retrieve state.
method getStorageKey
protected getStorageKey: (_turnContext: TurnContext) => string;
Gets the key to use when reading and writing state to and from storage.
Parameter _turnContext
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Returns
The storage key.
class SetSpeakMiddleware
class SetSpeakMiddleware implements Middleware {}
Support the DirectLine speech and telephony channels to ensure the appropriate SSML tags are set on the Activity Speak property.
constructor
constructor(voiceName: string, fallbackToTextForSpeak: boolean);
Initializes a new instance of the SetSpeakMiddleware class.
Parameter voiceName
The SSML voice name attribute value.
Parameter fallbackToTextForSpeak
true if an empty Activity.Speak is populated with Activity.Text.
method onTurn
onTurn: (turnContext: TurnContext, next: () => Promise<void>) => Promise<void>;
Processes an incoming activity.
Parameter turnContext
The context object for this turn.
Parameter next
The delegate to call to continue the bot middleware pipeline.
Returns
A promise representing the async operation.
class SharePointActivityHandler
class SharePointActivityHandler extends ActivityHandler {}
The SharePointActivityHandler is derived from ActivityHandler. It adds support for the SharePoint specific events and interactions
method onInvokeActivity
protected onInvokeActivity: (context: TurnContext) => Promise<InvokeResponse>;
Invoked when an invoke activity is received from the connector. Invoke activities can be used to communicate many different things. * Invoke activities communicate programmatic commands from a client or channel to a bot.
Parameter context
A strongly-typed context object for this turn
Returns
A task that represents the work queued to execute
method onSharePointTaskGetCardViewAsync
protected onSharePointTaskGetCardViewAsync: ( _context: TurnContext, _aceRequest: AceRequest) => Promise<CardViewResponse>;
Override this in a derived class to provide logic for when a card view is fetched
Parameter _context
A strongly-typed context object for this turn
Parameter _aceRequest
The Ace invoke request value payload
Returns
A Card View Response for the request
method onSharePointTaskGetPropertyPaneConfigurationAsync
protected onSharePointTaskGetPropertyPaneConfigurationAsync: ( _context: TurnContext, _aceRequest: AceRequest) => Promise<GetPropertyPaneConfigurationResponse>;
Override this in a derived class to provide logic for getting configuration pane properties.
Parameter _context
A strongly-typed context object for this turn
Parameter _aceRequest
The Ace invoke request value payload
Returns
A Property Pane Configuration Response for the request
method onSharePointTaskGetQuickViewAsync
protected onSharePointTaskGetQuickViewAsync: ( _context: TurnContext, _aceRequest: AceRequest) => Promise<QuickViewResponse>;
Override this in a derived class to provide logic for when a quick view is fetched
Parameter _context
A strongly-typed context object for this turn
Parameter _aceRequest
The Ace invoke request value payload
Returns
A Quick View Response for the request
method onSharePointTaskHandleActionAsync
protected onSharePointTaskHandleActionAsync: ( _context: TurnContext, _aceRequest: AceRequest) => Promise<HandleActionResponse>;
Override this in a derived class to provide logic for setting configuration pane properties.
Parameter _context
A strongly-typed context object for this turn
Parameter _aceRequest
The Ace invoke request value payload
Returns
A handle action response
method onSharePointTaskSetPropertyPaneConfigurationAsync
protected onSharePointTaskSetPropertyPaneConfigurationAsync: ( _context: TurnContext, _aceRequest: AceRequest) => Promise<SetPropertyPaneConfigurationResponse>;
Override this in a derived class to provide logic for setting configuration pane properties.
Parameter _context
A strongly-typed context object for this turn
Parameter _aceRequest
The Ace invoke request value payload
Returns
A Card view or no-op action response
class SkillHandler
class SkillHandler extends ChannelServiceHandler {}
Deprecated
Use
CloudSkillHandler
instead. A Bot Framework Handler for skills.
constructor
constructor( adapter: BotAdapter, bot: ActivityHandlerBase, conversationIdFactory: SkillConversationIdFactoryBase, credentialProvider: ICredentialProvider, authConfig: AuthenticationConfiguration, channelService?: string);
Initializes a new instance of the SkillHandler class.
Parameter adapter
An instance of the BotAdapter that will handle the request.
Parameter bot
The ActivityHandlerBase instance.
Parameter conversationIdFactory
A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot.
Parameter credentialProvider
The credential provider.
Parameter authConfig
The authentication configuration.
Parameter channelService
The string indicating if the bot is working in Public Azure or in Azure Government (https://aka.ms/AzureGovDocs).
property SkillConversationReferenceKey
readonly SkillConversationReferenceKey: Symbol;
Used to access the CovnersationReference sent from the Skill to the Parent.
Remarks
The value is the same as the SkillConversationReferenceKey exported from botbuilder-core.
method onDeleteActivity
protected onDeleteActivity: ( claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string) => Promise<void>;
DeleteActivity() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activityId
activityId to delete.
Returns
a promise representing the async operation
Remarks
Delete an existing activity.
Some channels allow you to delete an existing activity, and if successful this method will remove the specified activity.
method onReplyToActivity
protected onReplyToActivity: ( claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, activity: Activity) => Promise<ResourceResponse>;
replyToActivity() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activityId
activityId the reply is to.
Parameter activity
Activity to send.
Returns
A Promise with a ResourceResponse.
Remarks
This method allows you to reply to an activity.
This is slightly different from sendToConversation(). * sendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. * replyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, replyToActivity falls back to sendToConversation.
Use replyToActivity when replying to a specific activity in the conversation.
Use sendToConversation in all other cases.
method onSendToConversation
protected onSendToConversation: ( claimsIdentity: ClaimsIdentity, conversationId: string, activity: Activity) => Promise<ResourceResponse>;
sendToConversation() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activity
Activity to send.
Returns
A Promise with a ResourceResponse.
Remarks
This method allows you to send an activity to the end of a conversation.
This is slightly different from replyToActivity(). * sendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. * replyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, replyToActivity falls back to sendToConversation.
Use replyToActivity when replying to a specific activity in the conversation.
Use sendToConversation in all other cases.
method onUpdateActivity
protected onUpdateActivity: ( claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, activity: Activity) => Promise<ResourceResponse>;
UpdateActivity() API for Skill.
Parameter claimsIdentity
ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
Parameter conversationId
Conversation ID.
Parameter activityId
activityId to update.
Parameter activity
replacement Activity.
Returns
a promise resolving to the underlying resource response
Remarks
Edit an existing activity.
Some channels allow you to edit an existing activity to reflect the new state of a bot conversation.
For example, you can remove buttons after someone has clicked "Approve" button.
class SkillHttpClient
class SkillHttpClient extends BotFrameworkHttpClient {}
A BotFrameworkHttpClient specialized for Skills that encapsulates Conversation ID generation.
constructor
constructor( credentialProvider: ICredentialProvider, conversationIdFactory: SkillConversationIdFactoryBase, channelService?: string);
Creates a new instance of the [SkillHttpClient](xref:botbuilder-core.SkillHttpClient) class.
Parameter credentialProvider
An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider).
Parameter conversationIdFactory
An instance of a class derived from [SkillConversationIdFactoryBase](xref:botbuilder-core.SkillConversationIdFactoryBase).
Parameter channelService
Optional. The channel service.
method postToSkill
postToSkill: { <T>( originatingAudience: string, fromBotId: string, toSkill: BotFrameworkSkill, callbackUrl: string, activity: Activity ): Promise<InvokeResponse<T>>; ( fromBotId: string, toSkill: BotFrameworkSkill, callbackUrl: string, activity: Activity ): Promise<InvokeResponse>;};
Uses the SkillConversationIdFactory to create or retrieve a Skill Conversation Id, and sends the activity.
T The type of body in the InvokeResponse.
Parameter originatingAudience
The OAuth audience scope, used during token retrieval. (Either https://api.botframework.com or bot app id.)
Parameter fromBotId
The MicrosoftAppId of the bot sending the activity.
Parameter toSkill
The skill to create the Conversation Id for.
Parameter callbackUrl
The callback Url for the skill host.
Parameter activity
The activity to send.
Uses the SkillConversationIdFactory to create or retrieve a Skill Conversation Id, and sends the activity.
Parameter fromBotId
The MicrosoftAppId of the bot sending the activity.
Parameter toSkill
The skill to create the Conversation Id for.
Parameter callbackUrl
The callback Url for the skill host.
Parameter activity
The activity to send.
Deprecated
This overload is deprecated. Please use SkillHttpClient.postToSkill() that takes an
originatingAudience
.
class StatusCodeError
class StatusCodeError extends Error {}
Extends Error to provide specialized error messages.
constructor
constructor(statusCode: StatusCodes, message?: string);
Creates a new instance of the [StatusCodeError](xref:botbuilder.StatusCodeError) class.
Parameter statusCode
The status code.
Parameter message
Optional. The error message.
property statusCode
readonly statusCode: StatusCodes;
class StreamingHttpClient
class StreamingHttpClient implements HttpClient {}
An implementation of
HttpClient
that adds compatibility with streaming connections.
constructor
constructor(server: IStreamingTransportServer);
Creates a new streaming Http client.
Parameter server
Transport server implementation to be used.
method sendRequest
sendRequest: (httpRequest: WebResource) => Promise<HttpOperationResponse>;
This function hides the default sendRequest of the HttpClient, replacing it with a version that takes the WebResource created by the BotFrameworkAdapter and converting it to a form that can be sent over a streaming transport.
Parameter httpRequest
The outgoing request created by the BotframeworkAdapter.
Returns
The streaming transport compatible response to send back to the client.
class TeamsActivityHandler
class TeamsActivityHandler extends ActivityHandler {}
Adds support for Microsoft Teams specific events and interactions.
Remarks
Developers may handle Message Update, Message Delete, and Conversation Update activities sent from Microsoft Teams via two methods: 1. Overriding methods starting with
on..
and *not* ending in..Event()
(e.g.onTeamsMembersAdded()
), or instead 2. Passing callbacks to methods starting withon..
*and* ending in...Event()
(e.g.onTeamsMembersAddedEvent()
), to stay in line with older implementation.Developers should use either #1 or #2, above for all Message Update, Message Delete, and Conversation Update activities and not *both* #1 and #2 for the same activity. Meaning, developers should override
onTeamsMembersAdded()
and not use bothonTeamsMembersAdded()
andonTeamsMembersAddedEvent()
.Developers wanting to handle Invoke activities *must* override methods starting with
handle...()
(e.g.handleTeamsTaskModuleFetch()
).
method dispatchConversationUpdateActivity
protected dispatchConversationUpdateActivity: ( context: TurnContext) => Promise<void>;
Override this method to change the dispatching of ConversationUpdate activities.
Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method dispatchEventActivity
protected dispatchEventActivity: (context: TurnContext) => Promise<void>;
Runs the _event_ sub-type handlers, as appropriate, and then continues the event emission process.
Parameter context
The context object for the current turn.
Returns
A promise that represents the work queued.
Remarks
Override this method to support channel-specific behavior across multiple channels or to add custom event sub-type events.
method dispatchMessageDeleteActivity
protected dispatchMessageDeleteActivity: (context: TurnContext) => Promise<void>;
Override this method to change the dispatching of MessageDelete activities.
Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method dispatchMessageUpdateActivity
protected dispatchMessageUpdateActivity: (context: TurnContext) => Promise<void>;
Override this method to change the dispatching of MessageUpdate activities.
Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method handleTeamsAnonymousAppBasedLinkQuery
protected handleTeamsAnonymousAppBasedLinkQuery: ( _context: TurnContext, _query: AppBasedLinkQuery) => Promise<MessagingExtensionResponse>;
Receives invoke activities with Activity name of 'composeExtension/anonymousQueryLink'
Parameter _context
A context object for this turn.
Parameter _query
he invoke request body type for app-based link query.
Returns
The Messaging Extension Response for the query.
Remarks
Used in creating a Search-based Message Extension.
method handleTeamsAppBasedLinkQuery
protected handleTeamsAppBasedLinkQuery: ( _context: TurnContext, _query: AppBasedLinkQuery) => Promise<MessagingExtensionResponse>;
Receives invoke activities with Activity name of 'composeExtension/queryLink'
Parameter _context
A context object for this turn.
Parameter _query
he invoke request body type for app-based link query.
Returns
The Messaging Extension Response for the query.
Remarks
Used in creating a Search-based Message Extension.
method handleTeamsCardActionInvoke
protected handleTeamsCardActionInvoke: ( _context: TurnContext) => Promise<InvokeResponse>;
Handles a Teams Card Action Invoke activity.
Parameter _context
A context object for this turn.
Returns
An Invoke Response for the activity.
method handleTeamsConfigFetch
protected handleTeamsConfigFetch: ( _context: TurnContext, _configData: any) => Promise<ConfigResponse>;
Handles a config/fetch invoke activity.
Parameter _context
A context object for this turn.
Parameter _configData
The object representing the configuration.
Returns
A Config Response for the activity.
method handleTeamsConfigSubmit
protected handleTeamsConfigSubmit: ( _context: TurnContext, _configData: any) => Promise<ConfigResponse>;
Handles a config/submit invoke activity.
Parameter _context
A context object for this turn.
Parameter _configData
The object representing the configuration.
Returns
A Config Response for the activity.
method handleTeamsFileConsent
protected handleTeamsFileConsent: ( context: TurnContext, fileConsentCardResponse: FileConsentCardResponse) => Promise<void>;
Receives invoke activities with Activity name of 'fileConsent/invoke'. Handlers registered here run before
handleTeamsFileConsentAccept
andhandleTeamsFileConsentDecline
. Developers are not passed a pointer to the nexthandleTeamsFileConsent
handler because the _wrapper_ around the handler will callonDialogs
handlers after delegating tohandleTeamsFileConsentAccept
orhandleTeamsFileConsentDecline
.Parameter context
A context object for this turn.
Parameter fileConsentCardResponse
Represents the value of the invoke activity sent when the user acts on a file consent card.
Returns
A promise that represents the work queued.
method handleTeamsFileConsentAccept
protected handleTeamsFileConsentAccept: ( _context: TurnContext, _fileConsentCardResponse: FileConsentCardResponse) => Promise<void>;
Receives invoke activities with Activity name of 'fileConsent/invoke' with confirmation from user
Parameter _context
A context object for this turn.
Parameter _fileConsentCardResponse
Represents the value of the invoke activity sent when the user acts on a file consent card.
Returns
A promise that represents the work queued.
Remarks
This type of invoke activity occur during the File Consent flow.
method handleTeamsFileConsentDecline
protected handleTeamsFileConsentDecline: ( _context: TurnContext, _fileConsentCardResponse: FileConsentCardResponse) => Promise<void>;
Receives invoke activities with Activity name of 'fileConsent/invoke' with decline from user
Parameter _context
A context object for this turn.
Parameter _fileConsentCardResponse
Represents the value of the invoke activity sent when the user acts on a file consent card.
Returns
A promise that represents the work queued.
Remarks
This type of invoke activity occur during the File Consent flow.
method handleTeamsMessagingExtensionBotMessagePreviewEdit
protected handleTeamsMessagingExtensionBotMessagePreviewEdit: ( _context: TurnContext, _action: MessagingExtensionAction) => Promise<MessagingExtensionActionResponse>;
Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. The value for 'botMessagePreview' is 'edit'.
Parameter _context
A context object for this turn.
Parameter _action
The messaging extension action.
Returns
The Messaging Extension Action Response for the action.
method handleTeamsMessagingExtensionBotMessagePreviewSend
protected handleTeamsMessagingExtensionBotMessagePreviewSend: ( _context: TurnContext, _action: MessagingExtensionAction) => Promise<MessagingExtensionActionResponse>;
Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. The value for 'botMessagePreview' is 'send'.
Parameter _context
A context object for this turn.
Parameter _action
The messaging extension action.
Returns
The Messaging Extension Action Response for the action.
method handleTeamsMessagingExtensionCardButtonClicked
protected handleTeamsMessagingExtensionCardButtonClicked: ( _context: TurnContext, _cardData: any) => Promise<void>;
Receives invoke activities with Activity name of 'composeExtension/onCardButtonClicked'
Parameter _context
A context object for this turn.
Parameter _cardData
Object representing the card data.
Returns
A promise that represents the work queued.
method handleTeamsMessagingExtensionConfigurationQuerySettingUrl
protected handleTeamsMessagingExtensionConfigurationQuerySettingUrl: ( _context: TurnContext, _query: MessagingExtensionQuery) => Promise<MessagingExtensionResponse>;
Receives invoke activities with the name 'composeExtension/querySettingUrl'
Parameter _context
A context object for this turn.
Parameter _query
The Messaging extension query.
Returns
The Messaging Extension Action Response for the query.
method handleTeamsMessagingExtensionConfigurationSetting
protected handleTeamsMessagingExtensionConfigurationSetting: ( _context: TurnContext, _settings: any) => Promise<void>;
Receives invoke activities with the name 'composeExtension/setting'
Parameter _context
A context object for this turn.
Parameter _settings
Object representing the configuration settings.
method handleTeamsMessagingExtensionFetchTask
protected handleTeamsMessagingExtensionFetchTask: ( _context: TurnContext, _action: MessagingExtensionAction) => Promise<MessagingExtensionActionResponse>;
Receives invoke activities with the name 'composeExtension/fetchTask'
Parameter _context
A context object for this turn.
Parameter _action
The messaging extension action.
Returns
The Messaging Extension Action Response for the action.
method handleTeamsMessagingExtensionQuery
protected handleTeamsMessagingExtensionQuery: ( _context: TurnContext, _query: MessagingExtensionQuery) => Promise<MessagingExtensionResponse>;
Receives invoke activities with the name 'composeExtension/query'.
Parameter _context
A context object for this turn.
Parameter _query
The query for the search command.
Returns
The Messaging Extension Response for the query.
Remarks
Used in creating a Search-based Message Extension.
method handleTeamsMessagingExtensionSelectItem
protected handleTeamsMessagingExtensionSelectItem: ( _context: TurnContext, _query: any) => Promise<MessagingExtensionResponse>;
Receives invoke activities with the name 'composeExtension/selectItem'.
Parameter _context
A context object for this turn.
Parameter _query
The object representing the query.
Returns
The Messaging Extension Response for the query.
Remarks
Used in creating a Search-based Message Extension.
method handleTeamsMessagingExtensionSubmitAction
protected handleTeamsMessagingExtensionSubmitAction: ( _context: TurnContext, _action: MessagingExtensionAction) => Promise<MessagingExtensionActionResponse>;
Receives invoke activities with the name 'composeExtension/submitAction'.
Parameter _context
A context object for this turn.
Parameter _action
The messaging extension action.
Returns
The Messaging Extension Action Response for the action.
method handleTeamsMessagingExtensionSubmitActionDispatch
protected handleTeamsMessagingExtensionSubmitActionDispatch: ( context: TurnContext, action: MessagingExtensionAction) => Promise<MessagingExtensionActionResponse>;
Receives invoke activities with the name 'composeExtension/submitAction' and dispatches to botMessagePreview-flows as applicable.
Parameter context
A context object for this turn.
Parameter action
The messaging extension action.
Returns
The Messaging Extension Action Response for the action.
Remarks
A handler registered through this method does not dispatch to the next handler (either
handleTeamsMessagingExtensionSubmitAction
,handleTeamsMessagingExtensionBotMessagePreviewEdit
, orhandleTeamsMessagingExtensionBotMessagePreviewSend
). This method exists for developers to optionally add more logic before the TeamsActivityHandler routes the activity to one of the previously mentioned handlers.
method handleTeamsO365ConnectorCardAction
protected handleTeamsO365ConnectorCardAction: ( _context: TurnContext, _query: O365ConnectorCardActionQuery) => Promise<void>;
Receives invoke activities with Activity name of 'actionableMessage/executeAction'.
Parameter _context
A context object for this turn.
Parameter _query
The O365 connector card HttpPOST invoke query.
Returns
A promise that represents the work queued.
method handleTeamsSigninTokenExchange
protected handleTeamsSigninTokenExchange: ( _context: TurnContext, _query: SigninStateVerificationQuery) => Promise<void>;
Receives invoke activities with Activity name of 'signin/tokenExchange'
Parameter _context
A context object for this turn.
Parameter _query
Signin state (part of signin action auth flow) verification invoke query
Returns
A promise that represents the work queued.
method handleTeamsSigninVerifyState
protected handleTeamsSigninVerifyState: ( _context: TurnContext, _query: SigninStateVerificationQuery) => Promise<void>;
Receives invoke activities with Activity name of 'signin/verifyState'.
Parameter _context
A context object for this turn.
Parameter _query
Signin state (part of signin action auth flow) verification invoke query.
Returns
A promise that represents the work queued.
method handleTeamsTabFetch
protected handleTeamsTabFetch: ( _context: TurnContext, _tabRequest: TabRequest) => Promise<TabResponse>;
Receives invoke activities with Activity name of 'tab/fetch'
Parameter _context
A context object for this turn.
Parameter _tabRequest
The tab invoke request value payload.
Returns
A Tab Response for the request.
method handleTeamsTabSubmit
protected handleTeamsTabSubmit: ( _context: TurnContext, _tabSubmit: TabSubmit) => Promise<TabResponse>;
Receives invoke activities with Activity name of 'tab/submit'
Parameter _context
A context object for this turn.
Parameter _tabSubmit
The tab submit invoke request value payload.
Returns
A Tab Response for the request.
method handleTeamsTaskModuleFetch
protected handleTeamsTaskModuleFetch: ( _context: TurnContext, _taskModuleRequest: TaskModuleRequest) => Promise<TaskModuleResponse>;
Receives invoke activities with Activity name of 'task/fetch'
Parameter _context
A context object for this turn.
Parameter _taskModuleRequest
The task module invoke request value payload.
Returns
A Task Module Response for the request.
method handleTeamsTaskModuleSubmit
protected handleTeamsTaskModuleSubmit: ( _context: TurnContext, _taskModuleRequest: TaskModuleRequest) => Promise<TaskModuleResponse>;
Receives invoke activities with Activity name of 'task/submit'
Parameter _context
A context object for this turn.
Parameter _taskModuleRequest
The task module invoke request value payload.
Returns
A Task Module Response for the request.
method onInvokeActivity
protected onInvokeActivity: (context: TurnContext) => Promise<InvokeResponse>;
Invoked when an invoke activity is received from the connector. Invoke activities can be used to communicate many different things.
Parameter context
A context object for this turn.
Returns
An Invoke Response for the activity.
method onSignInInvoke
protected onSignInInvoke: (context: TurnContext) => Promise<void>;
Invoked when a signIn invoke activity is received from the connector.
Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method onTeamsChannelCreated
protected onTeamsChannelCreated: (context: TurnContext) => Promise<void>;
Invoked when a Channel Created event activity is received from the connector. Channel Created corresponds to the user creating a new channel. Override this in a derived class to provide logic for when a channel is created.
Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method onTeamsChannelCreatedEvent
onTeamsChannelCreatedEvent: ( handler: ( channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsChannelCreated events, such as for when a channel is created.
Parameter handler
A callback to handle the teams channel created event.
Returns
A promise that represents the work queued.
method onTeamsChannelDeleted
protected onTeamsChannelDeleted: (context: TurnContext) => Promise<void>;
Invoked when a Channel Deleted event activity is received from the connector. Channel Deleted corresponds to the user deleting a channel. Override this in a derived class to provide logic for when a channel is deleted.
Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method onTeamsChannelDeletedEvent
onTeamsChannelDeletedEvent: ( handler: ( channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsChannelDeleted events, such as for when a channel is deleted.
Parameter handler
A callback to handle the teams channel deleted event.
Returns
A promise that represents the work queued.
method onTeamsChannelRenamed
protected onTeamsChannelRenamed: (context: TurnContext) => Promise<void>;
Invoked when a Channel Renamed event activity is received from the connector. Channel Renamed corresponds to the user renaming a new channel. Override this in a derived class to provide logic for when a channel is renamed.
Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method onTeamsChannelRenamedEvent
onTeamsChannelRenamedEvent: ( handler: ( channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsChannelRenamed events, such as for when a channel is renamed.
Parameter handler
A callback to handle the teams channel renamed event.
Returns
A promise that represents the work queued.
method onTeamsChannelRestored
protected onTeamsChannelRestored: (context: TurnContext) => Promise<void>;
Invoked when a Channel Restored event activity is received from the connector. Channel Restored corresponds to the user restoring a previously deleted channel. Override this in a derived class to provide logic for when a channel is restored.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsChannelRestoredEvent
onTeamsChannelRestoredEvent: ( handler: ( channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsChannelRestored events, such as for when a channel is restored.
Parameter handler
A callback to handle the teams channel restored event.
Returns
A promise that represents the work queued.
method onTeamsMeetingEnd
protected onTeamsMeetingEnd: (context: TurnContext) => Promise<void>;
Invoked when a Meeting End event activity is received from the connector. Override this in a derived class to provide logic for when a meeting is ended.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsMeetingEndEvent
onTeamsMeetingEndEvent: ( handler: ( meeting: MeetingEndEventDetails, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for when a Teams meeting ends.
Parameter handler
A callback that handles Meeting End events.
Returns
A promise that represents the work queued.
method onTeamsMeetingParticipantsJoin
protected onTeamsMeetingParticipantsJoin: ( context: TurnContext) => Promise<void>;
Invoked when a Meeting Participant Join event activity is received from the connector. Override this in a derived class to provide logic for when a meeting participant is joined.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsMeetingParticipantsJoinEvent
onTeamsMeetingParticipantsJoinEvent: ( handler: ( meeting: MeetingParticipantsEventDetails, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for when a Teams meeting participant join.
Parameter handler
A callback that handles Meeting Participant Join events.
Returns
A promise that represents the work queued.
method onTeamsMeetingParticipantsLeave
protected onTeamsMeetingParticipantsLeave: ( context: TurnContext) => Promise<void>;
Invoked when a Meeting Participant Leave event activity is received from the connector. Override this in a derived class to provide logic for when a meeting participant is left.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsMeetingParticipantsLeaveEvent
onTeamsMeetingParticipantsLeaveEvent: ( handler: ( meeting: MeetingParticipantsEventDetails, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for when a Teams meeting participant leave.
Parameter handler
A callback that handles Meeting Participant Leave events.
Returns
A promise that represents the work queued.
method onTeamsMeetingStart
protected onTeamsMeetingStart: (context: TurnContext) => Promise<void>;
Invoked when a Meeting Started event activity is received from the connector. Override this in a derived class to provide logic for when a meeting is started.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsMeetingStartEvent
onTeamsMeetingStartEvent: ( handler: ( meeting: MeetingStartEventDetails, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for when a Teams meeting starts.
Parameter handler
A callback that handles Meeting Start events.
Returns
A promise that represents the work queued.
method onTeamsMembersAdded
protected onTeamsMembersAdded: (context: TurnContext) => Promise<void>;
Called in
dispatchConversationUpdateActivity()
to trigger the'TeamsMembersAdded'
handlers. Override this in a derived class to provide logic for when members other than the bot join the channel, such as your bot's welcome logic.Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
Remarks
If no handlers are registered for the
'TeamsMembersAdded'
event, the'MembersAdded'
handlers will run instead.
method onTeamsMembersAddedEvent
onTeamsMembersAddedEvent: ( handler: ( membersAdded: TeamsChannelAccount[], teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsMembersAdded events, such as for when members other than the bot join the channel, such as your bot's welcome logic.
Parameter handler
A callback to handle the teams members added event.
Returns
A promise that represents the work queued.
method onTeamsMembersRemoved
protected onTeamsMembersRemoved: (context: TurnContext) => Promise<void>;
Called in
dispatchConversationUpdateActivity()
to trigger the'TeamsMembersRemoved'
handlers. Override this in a derived class to provide logic for when members other than the bot leave the channel, such as your bot's good-bye logic.Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
Remarks
If no handlers are registered for the
'TeamsMembersRemoved'
event, the'MembersRemoved'
handlers will run instead.
method onTeamsMembersRemovedEvent
onTeamsMembersRemovedEvent: ( handler: ( membersRemoved: TeamsChannelAccount[], teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsMembersRemoved events, such as for when members other than the bot leave the channel, such as your bot's good-bye logic.
Parameter handler
A callback to handle the teams members removed event.
Returns
A promise that represents the work queued.
method onTeamsMessageEdit
protected onTeamsMessageEdit: (context: TurnContext) => Promise<void>;
Called in
dispatchMessageUpdateActivity()
to trigger the'TeamsMessageEdit'
handlers. Override this in a derived class to provide logic for when a message in a conversation is edited.Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method onTeamsMessageEditEvent
onTeamsMessageEditEvent: ( handler: (context: TurnContext, next: () => Promise<void>) => Promise<void>) => this;
Registers a handler for TeamsMessageEdit events, such as for when a message in a conversation that is observed by the bot is edited.
Parameter handler
A callback to handle the teams edit message event.
Returns
A promise that represents the work queued.
method onTeamsMessageSoftDelete
protected onTeamsMessageSoftDelete: (context: TurnContext) => Promise<void>;
Called in
dispatchMessageDeleteActivity()
to trigger the'TeamsMessageEdit'
handlers. Override this in a derived class to provide logic for when a message in a conversation is soft deleted. This means that the message as the option of being undeleted.Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method onTeamsMessageSoftDeleteEvent
onTeamsMessageSoftDeleteEvent: ( handler: (context: TurnContext, next: () => Promise<void>) => Promise<void>) => this;
Registers a handler for TeamsMessageSoftDelete events, such as for when a message in a conversation that is observed by the bot is soft deleted. This means that the deleted message, up to a certain time period, can be undoed.
Parameter handler
A callback to handle the teams edit message event.
Returns
A promise that represents the work queued.
method onTeamsMessageUndelete
protected onTeamsMessageUndelete: (context: TurnContext) => Promise<void>;
Called in
dispatchMessageUpdateActivity()
to trigger the'TeamsMessageUndelete'
handlers. Override this in a derived class to provide logic for when a deleted message in a conversation is undeleted. For example, when the user decides to "undo" a deleted message.Parameter context
A context object for this turn.
Returns
A promise that represents the work queued.
method onTeamsMessageUndeleteEvent
onTeamsMessageUndeleteEvent: ( handler: (context: TurnContext, next: () => Promise<void>) => Promise<void>) => this;
Registers a handler for TeamsMessageUndelete events, such as for when a message in a conversation that is observed by the bot goes from a soft delete state to the normal state.
Parameter handler
A callback to handle the teams undelete message event.
Returns
A promise that represents the work queued.
method onTeamsReadReceipt
protected onTeamsReadReceipt: (context: TurnContext) => Promise<void>;
Invoked when a read receipt for a previously sent message is received from the connector. Override this in a derived class to provide logic for when the bot receives a read receipt event.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsReadReceiptEvent
onTeamsReadReceiptEvent: ( handler: ( receiptInfo: ReadReceiptInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for when a Read Receipt is sent.
Parameter handler
A callback that handles Read Receipt events.
Returns
A promise that represents the work queued.
method onTeamsTeamArchived
protected onTeamsTeamArchived: (context: TurnContext) => Promise<void>;
Invoked when a Team Archived event activity is received from the connector. Team Archived corresponds to the user archiving a team. Override this in a derived class to provide logic for when a team is archived.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsTeamArchivedEvent
onTeamsTeamArchivedEvent: ( handler: ( teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsTeamArchived events, such as for when a team is archived.
Parameter handler
A callback to handle the teams team archived event.
Returns
A promise that represents the work queued.
method onTeamsTeamDeleted
protected onTeamsTeamDeleted: (context: TurnContext) => Promise<void>;
Invoked when a Team Deleted event activity is received from the connector. Team Deleted corresponds to the user deleting a team. Override this in a derived class to provide logic for when a team is deleted.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsTeamDeletedEvent
onTeamsTeamDeletedEvent: ( handler: ( teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsTeamDeleted events, such as for when a team is deleted.
Parameter handler
A callback to handle the teams team deleted event.
Returns
A promise that represents the work queued.
method onTeamsTeamHardDeleted
protected onTeamsTeamHardDeleted: (context: TurnContext) => Promise<void>;
Invoked when a Team Hard Deleted event activity is received from the connector. Team Hard Deleted corresponds to the user hard-deleting a team. Override this in a derived class to provide logic for when a team is hard-deleted.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsTeamHardDeletedEvent
onTeamsTeamHardDeletedEvent: ( handler: ( teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsTeamHardDeleted events, such as for when a team is hard-deleted.
Parameter handler
A callback to handle the teams team hard deleted event.
Returns
A promise that represents the work queued.
method onTeamsTeamRenamed
protected onTeamsTeamRenamed: (context: TurnContext) => Promise<void>;
Invoked when a Team Renamed event activity is received from the connector. Team Renamed corresponds to the user renaming a team. Override this in a derived class to provide logic for when a team is renamed.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsTeamRenamedEvent
onTeamsTeamRenamedEvent: ( handler: ( teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsTeamRenamed events, such as for when a team is renamed.
Parameter handler
A callback to handle the teams team renamed event.
Returns
A promise that represents the work queued.
method onTeamsTeamRestored
protected onTeamsTeamRestored: (context: TurnContext) => Promise<void>;
Invoked when a Team Restored event activity is received from the connector. Team Restored corresponds to the user restoring a team. Override this in a derived class to provide logic for when a team is restored.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsTeamRestoredEvent
onTeamsTeamRestoredEvent: ( handler: ( teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsTeamRestored events, such as for when a team is restored.
Parameter handler
A callback to handle the teams team restored event.
Returns
A promise that represents the work queued.
method onTeamsTeamUnarchived
protected onTeamsTeamUnarchived: (context: TurnContext) => Promise<void>;
Invoked when a Team Unarchived event activity is received from the connector. Team Unarchived corresponds to the user unarchiving a team. Override this in a derived class to provide logic for when a team is unarchived.
Parameter context
The context for this turn.
Returns
A promise that represents the work queued.
method onTeamsTeamUnarchivedEvent
onTeamsTeamUnarchivedEvent: ( handler: ( teamInfo: TeamInfo, context: TurnContext, next: () => Promise<void> ) => Promise<void>) => this;
Registers a handler for TeamsTeamUnarchived events, such as for when a team is unarchived.
Parameter handler
A callback to handle the teams team unarchived event.
Returns
A promise that represents the work queued.
class TeamsInfo
class TeamsInfo {}
Provides utility methods for the events and interactions that occur within Microsoft Teams.
method cancelOperation
static cancelOperation: ( context: TurnContext, operationId: string) => Promise<CancelOperationResponse>;
Cancels a pending operation.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter operationId
The id of the operation to cancel.
Returns
Promise representing the asynchronous operation.
method getFailedEntries
static getFailedEntries: ( context: TurnContext, operationId: string) => Promise<BatchFailedEntriesResponse>;
Gets the failed entries of an executed operation.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter operationId
The operationId to get the failed entries of.
Returns
Promise with the list of failed entries of the operation.
method getMeetingInfo
static getMeetingInfo: ( context: TurnContext, meetingId?: string) => Promise<MeetingInfo>;
Gets the information for the given meeting id.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter meetingId
The BASE64-encoded id of the Teams meeting.
Returns
The [MeetingInfo](xref:botframework-schema.MeetingInfo) fetched
method getMeetingParticipant
static getMeetingParticipant: ( context: TurnContext, meetingId?: string, participantId?: string, tenantId?: string) => Promise<TeamsMeetingParticipant>;
Gets the meeting participant for the given meeting id and participant id. This only works in teams scoped meeting conversations.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter meetingId
The meeting ID to fetch
Parameter participantId
The participant ID to fetch
Parameter tenantId
The tenant ID to use when scoping the request
Returns
The [TeamsMeetingParticipant](xref:botbuilder-core.TeamsMeetingParticipant) fetched
method getMember
static getMember: ( context: TurnContext, userId: string) => Promise<TeamsChannelAccount>;
Gets the account of a single conversation member.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter userId
ID of the user in question.
Returns
The [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) of the member.
method getMembers
static getMembers: (context: TurnContext) => Promise<TeamsChannelAccount[]>;
Gets the conversation members of a one-on-one or group chat.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Returns
The list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount).
Deprecated
Use
getPagedTeamMembers
instead.
method getOperationState
static getOperationState: ( context: TurnContext, operationId: string) => Promise<BatchOperationStateResponse>;
Gets the operation state.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter operationId
The operationId to get the state of.
Returns
Promise with The state and responses of the operation.
method getPagedMembers
static getPagedMembers: ( context: TurnContext, pageSize?: number, continuationToken?: string) => Promise<TeamsPagedMembersResult>;
Gets a pagined list of members of one-on-one, group, or team conversation.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter pageSize
Suggested number of entries on a page.
Parameter continuationToken
A continuation token.
Returns
The [TeamsPagedMembersResult](xref:botframework-schema.TeamsPagedMembersResult) with the list of members.
method getPagedTeamMembers
static getPagedTeamMembers: ( context: TurnContext, teamId?: string, pageSize?: number, continuationToken?: string) => Promise<TeamsPagedMembersResult>;
Gets a paginated list of members of a team.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter teamId
ID of the Teams team.
Parameter pageSize
The number of entries on the page.
Parameter continuationToken
The continuationToken token.
Returns
A [TeamsPagedMembersResult](xref:botframework-schema.TeamsPagedMembersResult) with the list of members.
method getTeamChannels
static getTeamChannels: ( context: TurnContext, teamId?: string) => Promise<ChannelInfo[]>;
Returns a list of channels in a Team. This only works in teams scoped conversations.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter teamId
ID of the Teams team.
Returns
The list of [ChannelInfo](xref:botframework-schema.ChannelInfo) objects with the conversations.
method getTeamDetails
static getTeamDetails: ( context: TurnContext, teamId?: string) => Promise<TeamDetails>;
Gets the details for the given team id. This only works in teams scoped conversations.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter teamId
The id of the Teams team.
Returns
The [TeamDetails](xref:botbuilder-core.TeamDetails) fetched
method getTeamMember
static getTeamMember: ( context: TurnContext, teamId?: string, userId?: string) => Promise<TeamsChannelAccount>;
Gets the account of a member in a teams scoped conversation.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter teamId
ID of the Teams team.
Parameter userId
ID of the Teams user.
Returns
The [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) of the member.
method getTeamMembers
static getTeamMembers: ( context: TurnContext, teamId?: string) => Promise<TeamsChannelAccount[]>;
Gets the list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) within a team.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter teamId
ID of the Teams team.
Returns
The list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) of the members.
Deprecated
Use
getPagedTeamMembers
instead.
method sendMeetingNotification
static sendMeetingNotification: ( context: TurnContext, notification: MeetingNotification, meetingId?: string) => Promise<MeetingNotificationResponse>;
Sends a meeting notification to specific users in a Teams meeting.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter notification
The meeting notification payload.
Parameter meetingId
Id of the Teams meeting.
Returns
Promise with either an empty object if notifications were successfully sent to all recipients or [MeetingNotificationResponse](xref:botframework-schema.MeetingNotificationResponse) if notifications were sent to some but not all recipients.
method sendMessageToAllUsersInTeam
static sendMessageToAllUsersInTeam: ( context: TurnContext, activity: Activity, tenantId: string, teamId: string) => Promise<BatchOperationResponse>;
Sends a message to all the users in a team.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter activity
The activity to send.
Parameter tenantId
The tenant ID.
Parameter teamId
The team ID.
Returns
Promise with operationId.
method sendMessageToAllUsersInTenant
static sendMessageToAllUsersInTenant: ( context: TurnContext, activity: Activity, tenantId: string) => Promise<BatchOperationResponse>;
Sends a message to all the users in a tenant.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter activity
The activity to send.
Parameter tenantId
The tenant ID.
Returns
Promise with operationId.
method sendMessageToListOfChannels
static sendMessageToListOfChannels: ( context: TurnContext, activity: Activity, tenantId: string, members: TeamsMember[]) => Promise<BatchOperationResponse>;
Sends a message to the provided list of Teams channels.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter activity
The activity to send.
Parameter tenantId
The tenant ID.
Parameter members
The list of channels recipients for the message.
Returns
Promise with operationId.
method sendMessageToListOfUsers
static sendMessageToListOfUsers: ( context: TurnContext, activity: Activity, tenantId: string, members: TeamsMember[]) => Promise<BatchOperationResponse>;
Sends a message to the provided users in the list of Teams members.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter activity
The activity to send.
Parameter tenantId
The tenant ID.
Parameter members
The list of users recipients for the message.
Returns
Promise with operationId.
method sendMessageToTeamsChannel
static sendMessageToTeamsChannel: ( context: TurnContext, activity: Activity, teamsChannelId: string, botAppId?: string) => Promise<[ConversationReference, string]>;
Creates a new thread in a Teams chat and sends an [Activity](xref:botframework-schema.Activity) to that new thread.
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter activity
The [Activity](xref:botframework-schema.Activity) to send.
Parameter teamsChannelId
The Team's Channel ID, note this is distinct from the Bot Framework activity property with same name.
Parameter botAppId
The bot's appId. This is only used when context.adapter is an instance of CloudAdapter.
Returns
The [ConversationReference](xref:botframework-schema.ConversationReference) and the id of the [Activity](xref:botframework-schema.Activity) (if sent).
class TeamsSSOTokenExchangeMiddleware
class TeamsSSOTokenExchangeMiddleware implements Middleware {}
If the activity name is signin/tokenExchange, this middleware will attempt to exchange the token, and deduplicate the incoming call, ensuring only one exchange request is processed.
If a user is signed into multiple Teams clients, the Bot could receive a "signin/tokenExchange" from each client. Each token exchange request for a specific user login will have an identical activity.value.id.
Only one of these token exchange requests should be processed by the bot. The others return [StatusCodes.PRECONDITION_FAILED](xref:botframework-schema:StatusCodes.PRECONDITION_FAILED). For a distributed bot in production, this requires distributed storage ensuring only one token exchange is processed. This middleware supports CosmosDb storage found in botbuilder-azure, or MemoryStorage for local development.
constructor
constructor(storage: Storage, oAuthConnectionName: string);
Initializes a new instance of the TeamsSSOTokenExchangeMiddleware class.
Parameter storage
The [Storage](xref:botbuilder-core.Storage) to use for deduplication
Parameter oAuthConnectionName
The connection name to use for the single sign on token exchange
method onTurn
onTurn: (context: TurnContext, next: () => Promise<void>) => Promise<void>;
Called each time the bot receives a new request.
Parameter context
Context for current turn of conversation with the user.
Parameter next
Function to call to continue execution to the next step in the middleware chain.
class TokenResolver
class TokenResolver {}
Looks for OAuthCards in Activity attachments and takes action on them
method checkForOAuthCards
static checkForOAuthCards: ( adapter: BotFrameworkAdapter, context: TurnContext, activity: Activity, log?: string[]) => void;
Checks if we have token responses from OAuth cards.
Parameter adapter
The [BotFrameworkAdapter](xref:botbuilder.BotFrameworkAdapter).
Parameter context
The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
Parameter activity
The [Activity](xref:botframework-schema.Activity) to be checked.
Parameter log
Optional. The log to write on.
Interfaces
interface BotFrameworkAdapterSettings
interface BotFrameworkAdapterSettings {}
Deprecated
Use
CloudAdapter
withConfigurationBotFrameworkAuthentication
instead to configure bot runtime. Contains settings used to configure a [BotFrameworkAdapter](xref:botbuilder.BotFrameworkAdapter) instance.
property appId
appId: string;
The ID assigned to your bot in the [Bot Framework Portal](https://dev.botframework.com/).
property appPassword
appPassword: string;
The password assigned to your bot in the [Bot Framework Portal](https://dev.botframework.com/).
property authConfig
authConfig?: AuthenticationConfiguration;
Optional. Used to require specific endorsements and verify claims. Recommended for Skills.
property certificatePrivateKey
certificatePrivateKey?: string;
Optional. Certificate key to authenticate the appId against AAD.
property certificateThumbprint
certificateThumbprint?: string;
Optional. Certificate thumbprint to authenticate the appId against AAD.
property channelAuthTenant
channelAuthTenant?: string;
Optional. The tenant to acquire the bot-to-channel token from.
property channelService
channelService?: string;
Optional. The channel service option for this bot to validate connections from Azure or other channel locations.
property clientOptions
clientOptions?: ConnectorClientOptions;
Optional. Used when creating new ConnectorClients.
property oAuthEndpoint
oAuthEndpoint?: string;
Optional. The OAuth API endpoint for your bot to use.
property openIdMetadata
openIdMetadata?: string;
Optional. The OpenID Metadata endpoint for your bot to use.
property webSocketFactory
webSocketFactory?: NodeWebSocketFactoryBase;
Optional. Used to pass in a NodeWebSocketFactoryBase instance.
interface BotFrameworkHttpAdapter
interface BotFrameworkHttpAdapter {}
Deprecated
Use
CloudAdapter
instead. BotFrameworkHttpAdapter is the interface that describes a Bot Framework adapter that operates on HTTP requests.
method process
process: { ( req: Request, res: Response, logic: (context: TurnContext) => Promise<void> ): Promise<void>; ( req: Request<Record<string, unknown>, Record<string, string | string[]>>, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise<void> ): Promise<void>;};
Process a web request by applying a logic callback function.
Handle a web socket connection by applying a logic callback function to each streaming request.
interface Request
interface Request< Body extends Record<string, unknown> = Record<string, unknown>, Headers extends Record<string, string[] | string | undefined> = Record< string, string[] | string | undefined >> {}
Represents a Node.js HTTP Request, including the minimal set of use properties. Compatible with Restify, Express, and Node.js core http.
interface Response
interface Response {}
interface WebRequest
interface WebRequest {}
Represents an Express or Restify request object.
This interface supports the framework and is not intended to be called directly for your code.
property body
body?: any;
Optional. The request body.
property headers
headers: any;
* Optional. The request headers.
property method
method?: any;
* Optional. The request method.
property params
params?: any;
* Optional. The request parameters from the url.
property query
query?: any;
* Optional. The values from the query string.
method on
on: (event: string, ...args: any[]) => any;
When implemented in a derived class, adds a listener for an event. The framework uses this method to retrieve the request body when the [body](xref:botbuilder.WebRequest.body) property is
null
orundefined
.Parameter event
The event name.
Parameter args
Arguments used to handle the event.
Returns
A reference to the request object.
interface WebResponse
interface WebResponse {}
Represents an Express or Restify response object.
This interface supports the framework and is not intended to be called directly for your code.
property socket
socket?: any;
Optional. The underlying socket.
method end
end: (...args: any[]) => any;
When implemented in a derived class, sends a FIN packet.
Parameter args
The arguments for the end event.
Returns
A reference to the response object.
method send
send: (body: any) => any;
When implemented in a derived class, sends the response.
Parameter body
The response payload.
Returns
A reference to the response object.
method status
status: (status: number) => any;
When implemented in a derived class, sets the HTTP status code for the response.
Parameter status
The status code to use.
Returns
The status code.
interface WebServer
interface WebServer {}
Interface representing an Express Application or a Restify Server.
property del
del?: (path: string, handler: RouteHandler) => void;
property delete
delete?: (path: string, handler: RouteHandler) => void;
property get
get: (path: string, handler: RouteHandler) => void;
property post
post: (path: string, handler: RouteHandler) => void;
property put
put: (path: string, handler: RouteHandler) => void;
Type Aliases
type RouteHandler
type RouteHandler = (request: WebRequest, response: WebResponse) => void;
Package Files (28)
- lib/botFrameworkAdapter.d.ts
- lib/botFrameworkHttpAdapter.d.ts
- lib/botFrameworkHttpClient.d.ts
- lib/channelServiceHandler.d.ts
- lib/channelServiceHandlerBase.d.ts
- lib/channelServiceRoutes.d.ts
- lib/cloudAdapter.d.ts
- lib/eventFactory.d.ts
- lib/fileTranscriptStore.d.ts
- lib/handoffEventNames.d.ts
- lib/index.d.ts
- lib/inspectionMiddleware.d.ts
- lib/interfaces/request.d.ts
- lib/interfaces/response.d.ts
- lib/interfaces/webRequest.d.ts
- lib/interfaces/webResponse.d.ts
- lib/setSpeakMiddleware.d.ts
- lib/sharepoint/sharePointActivityHandler.d.ts
- lib/skills/cloudSkillHandler.d.ts
- lib/skills/skillHandler.d.ts
- lib/skills/skillHttpClient.d.ts
- lib/statusCodeError.d.ts
- lib/streaming/streamingHttpClient.d.ts
- lib/streaming/tokenResolver.d.ts
- lib/teams/teamsSSOTokenExchangeMiddleware.d.ts
- lib/teamsActivityHandler.d.ts
- lib/teamsActivityHelpers.d.ts
- lib/teamsInfo.d.ts
Dependencies (14)
Dev Dependencies (4)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/botbuilder
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/botbuilder)
- HTML<a href="https://www.jsdocs.io/package/botbuilder"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 8579 ms. - Missing or incorrect documentation? Open an issue for this package.