/** * @module botbuilder */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { ActivityHandler, AdaptiveCardInvokeResponse, AppBasedLinkQuery, ChannelInfo, FileConsentCardResponse, InvokeResponse, MeetingStartEventDetails, MeetingEndEventDetails, MessagingExtensionAction, MessagingExtensionActionResponse, MessagingExtensionQuery, MessagingExtensionResponse, O365ConnectorCardActionQuery, SigninStateVerificationQuery, TabRequest, TabResponse, TabSubmit, TaskModuleRequest, TaskModuleResponse, TeamsChannelAccount, TeamInfo, TurnContext } from 'botbuilder-core'; /** * Adds support for Microsoft Teams specific events and interactions. * @remarks * Developers may handle 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 with `on..` *and* ending in `...Event()` (e.g. `onTeamsMembersAddedEvent()`), * to stay in line with older {@see ActivityHandler} implementation. * * Developers should use either #1 or #2, above for all Conversation Update activities and not *both* #2 and #3 for the same activity. Meaning, * developers should override `onTeamsMembersAdded()` and not use both `onTeamsMembersAdded()` and `onTeamsMembersAddedEvent()`. * * Developers wanting to handle Invoke activities *must* override methods starting with `handle...()` (e.g. `handleTeamsTaskModuleFetch()`). */ export declare class TeamsActivityHandler extends ActivityHandler { /** * Invoked when an invoke activity is received from the connector. * Invoke activities can be used to communicate many different things. * @param context A context object for this turn. * @returns An Invoke Response for the activity. */ protected onInvokeActivity(context: TurnContext): Promise; /** * Handles a Teams Card Action Invoke activity. * @param context A context object for this turn. * @returns An Invoke Response for the activity. */ protected handleTeamsCardActionInvoke(context: TurnContext): Promise; /** * Receives invoke activities with Activity name of 'fileConsent/invoke'. Handlers registered here run before * `handleTeamsFileConsentAccept` and `handleTeamsFileConsentDecline`. * Developers are not passed a pointer to the next `handleTeamsFileConsent` handler because the _wrapper_ around * the handler will call `onDialogs` handlers after delegating to `handleTeamsFileConsentAccept` or `handleTeamsFileConsentDecline`. * @param context A context object for this turn. * @param 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. */ protected handleTeamsFileConsent(context: TurnContext, fileConsentCardResponse: FileConsentCardResponse): Promise; /** * Receives invoke activities with Activity name of 'fileConsent/invoke' with confirmation from user * @remarks * This type of invoke activity occur during the File Consent flow. * @param context A context object for this turn. * @param 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. */ protected handleTeamsFileConsentAccept(context: TurnContext, fileConsentCardResponse: FileConsentCardResponse): Promise; /** * Receives invoke activities with Activity name of 'fileConsent/invoke' with decline from user * @remarks * This type of invoke activity occur during the File Consent flow. * @param context A context object for this turn. * @param 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. */ protected handleTeamsFileConsentDecline(context: TurnContext, fileConsentCardResponse: FileConsentCardResponse): Promise; /** * Receives invoke activities with Activity name of 'actionableMessage/executeAction'. * @param context A context object for this turn. * @param query The O365 connector card HttpPOST invoke query. * @returnsa A promise that represents the work queued. */ protected handleTeamsO365ConnectorCardAction(context: TurnContext, query: O365ConnectorCardActionQuery): Promise; /** * Invoked when a signIn invoke activity is received from the connector. * @param context A context object for this turn. * @returns A promise that represents the work queued. */ protected onSignInInvoke(context: TurnContext): Promise; /** * Receives invoke activities with Activity name of 'signin/verifyState'. * @param context A context object for this turn. * @param query Signin state (part of signin action auth flow) verification invoke query. * @returns A promise that represents the work queued. */ protected handleTeamsSigninVerifyState(context: TurnContext, query: SigninStateVerificationQuery): Promise; /** * Receives invoke activities with Activity name of 'signin/tokenExchange' * @param context A context object for this turn. * @param query Signin state (part of signin action auth flow) verification invoke query * @returns A promise that represents the work queued. */ protected handleTeamsSigninTokenExchange(context: TurnContext, query: SigninStateVerificationQuery): Promise; /** * Receives invoke activities with Activity name of 'composeExtension/onCardButtonClicked' * @param context A context object for this turn. * @param cardData Object representing the card data. * @returns A promise that represents the work queued. */ protected handleTeamsMessagingExtensionCardButtonClicked(context: TurnContext, cardData: any): Promise; /** * Receives invoke activities with Activity name of 'task/fetch' * @param context A context object for this turn. * @param taskModuleRequest The task module invoke request value payload. * @returns A Task Module Response for the request. */ protected handleTeamsTaskModuleFetch(context: TurnContext, taskModuleRequest: TaskModuleRequest): Promise; /** * Receives invoke activities with Activity name of 'task/submit' * @param context A context object for this turn. * @param taskModuleRequest The task module invoke request value payload. * @returns A Task Module Response for the request. */ protected handleTeamsTaskModuleSubmit(context: TurnContext, taskModuleRequest: TaskModuleRequest): Promise; /** * Receives invoke activities with Activity name of 'tab/fetch' * @param context A context object for this turn. * @param tabRequest The tab invoke request value payload. * @returns A Tab Response for the request. */ protected handleTeamsTabFetch(context: TurnContext, tabRequest: TabRequest): Promise; /** * Receives invoke activities with Activity name of 'tab/submit' * @param context A context object for this turn. * @param tabSubmit The tab submit invoke request value payload. * @returns A Tab Response for the request. */ protected handleTeamsTabSubmit(context: TurnContext, tabSubmit: TabSubmit): Promise; /** * Receives invoke activities with Activity name of 'composeExtension/queryLink' * @remarks * Used in creating a Search-based Message Extension. * @param context A context object for this turn. * @param query he invoke request body type for app-based link query. * @returns The Messaging Extension Response for the query. */ protected handleTeamsAppBasedLinkQuery(context: TurnContext, query: AppBasedLinkQuery): Promise; /** * Receives invoke activities with the name 'composeExtension/query'. * @remarks * Used in creating a Search-based Message Extension. * @param context A context object for this turn. * @param query The query for the search command. * @returns The Messaging Extension Response for the query. */ protected handleTeamsMessagingExtensionQuery(context: TurnContext, query: MessagingExtensionQuery): Promise; /** * Receives invoke activities with the name 'composeExtension/selectItem'. * @remarks * Used in creating a Search-based Message Extension. * @param context A context object for this turn. * @param query he object representing the query. * @returns The Messaging Extension Response for the query. */ protected handleTeamsMessagingExtensionSelectItem(context: TurnContext, query: any): Promise; /** * Receives invoke activities with the name 'composeExtension/submitAction' and dispatches to botMessagePreview-flows as applicable. * @remarks * A handler registered through this method does not dispatch to the next handler (either `handleTeamsMessagingExtensionSubmitAction`, `handleTeamsMessagingExtensionBotMessagePreviewEdit`, or `handleTeamsMessagingExtensionBotMessagePreviewSend`). * This method exists for developers to optionally add more logic before the TeamsActivityHandler routes the activity to one of the * previously mentioned handlers. * @param context A context object for this turn. * @param action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected handleTeamsMessagingExtensionSubmitActionDispatch(context: TurnContext, action: MessagingExtensionAction): Promise; /** * Receives invoke activities with the name 'composeExtension/submitAction'. * @param context A context object for this turn. * @param action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected handleTeamsMessagingExtensionSubmitAction(context: TurnContext, action: MessagingExtensionAction): Promise; /** * Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. * The value for 'botMessagePreview' is 'edit'. * @param context A context object for this turn. * @param action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected handleTeamsMessagingExtensionBotMessagePreviewEdit(context: TurnContext, action: MessagingExtensionAction): Promise; /** * Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. * The value for 'botMessagePreview' is 'send'. * @param context A context object for this turn. * @param action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected handleTeamsMessagingExtensionBotMessagePreviewSend(context: TurnContext, action: MessagingExtensionAction): Promise; /** * Receives invoke activities with the name 'composeExtension/fetchTask' * @param context A context object for this turn. * @param action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected handleTeamsMessagingExtensionFetchTask(context: TurnContext, action: MessagingExtensionAction): Promise; /** * Receives invoke activities with the name 'composeExtension/querySettingUrl' * @param context A context object for this turn. * @param query The Messaging extension query. * @returns The Messaging Extension Action Response for the query. */ protected handleTeamsMessagingExtensionConfigurationQuerySettingUrl(context: TurnContext, query: MessagingExtensionQuery): Promise; /** * Receives invoke activities with the name 'adaptiveCard/action' * @param context A context object for this turn. * @returns The Messaging Extension Action Response for the query. */ protected handleAdaptiveCardAction(context: TurnContext): Promise; /** * Receives invoke activities with the name 'composeExtension/setting' * @param context A context object for this turn. * @param settings Object representing the configuration settings. * @returns A promise that represents the work queued. */ protected handleTeamsMessagingExtensionConfigurationSetting(context: TurnContext, settings: any): Promise; /** * Override this method to change the dispatching of ConversationUpdate activities. * @param context A context object for this turn. * @returns A promise that represents the work queued. */ protected dispatchConversationUpdateActivity(context: TurnContext): Promise; /** * 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. * @remarks * If no handlers are registered for the `'TeamsMembersAdded'` event, the `'MembersAdded'` handlers will run instead. * @param context A context object for this turn. * @returns A promise that represents the work queued. */ protected onTeamsMembersAdded(context: TurnContext): Promise; /** * 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. * @remarks * If no handlers are registered for the `'TeamsMembersRemoved'` event, the `'MembersRemoved'` handlers will run instead. * @param context A context object for this turn. * @returns A promise that represents the work queued. */ protected onTeamsMembersRemoved(context: TurnContext): Promise; /** * 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. * @param context A context object for this turn. * @returns A promise that represents the work queued. */ protected onTeamsChannelCreated(context: any): Promise; /** * 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. * @param context A context object for this turn. * @returns A promise that represents the work queued. */ protected onTeamsChannelDeleted(context: any): Promise; /** * 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. * @param context A context object for this turn. * @returns A promise that represents the work queued. */ protected onTeamsChannelRenamed(context: any): Promise; /** * 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. * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsTeamArchived(context: any): Promise; /** * 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. * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsTeamDeleted(context: any): Promise; /** * 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. * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsTeamHardDeleted(context: any): Promise; /** * * @param context * 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. * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsChannelRestored(context: any): Promise; /** * 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. * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsTeamRenamed(context: any): Promise; /** * 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. * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsTeamRestored(context: any): Promise; /** * 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. * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsTeamUnarchived(context: any): Promise; /** * 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. * @param handler * @returns A promise that represents the work queued. */ onTeamsMembersAddedEvent(handler: (membersAdded: TeamsChannelAccount[], teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): 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. * @param handler * @returns A promise that represents the work queued. */ onTeamsMembersRemovedEvent(handler: (membersRemoved: TeamsChannelAccount[], teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsChannelCreated events, such as for when a channel is created. * @param handler * @returns A promise that represents the work queued. */ onTeamsChannelCreatedEvent(handler: (channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsChannelDeleted events, such as for when a channel is deleted. * @param handler * @returns A promise that represents the work queued. */ onTeamsChannelDeletedEvent(handler: (channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsChannelRenamed events, such as for when a channel is renamed. * @param handler * @returns A promise that represents the work queued. */ onTeamsChannelRenamedEvent(handler: (channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsTeamArchived events, such as for when a team is archived. * @param handler * @returns A promise that represents the work queued. */ onTeamsTeamArchivedEvent(handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsTeamDeleted events, such as for when a team is deleted. * @param handler * @returns A promise that represents the work queued. */ onTeamsTeamDeletedEvent(handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsTeamHardDeleted events, such as for when a team is hard-deleted. * @param handler * @returns A promise that represents the work queued. */ onTeamsTeamHardDeletedEvent(handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsChannelRestored events, such as for when a channel is restored. * @param handler * @returns A promise that represents the work queued. */ onTeamsChannelRestoredEvent(handler: (channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsTeamRenamed events, such as for when a team is renamed. * @param handler * @returns A promise that represents the work queued. */ onTeamsTeamRenamedEvent(handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsTeamRestored events, such as for when a team is restored. * @param handler * @returns A promise that represents the work queued. */ onTeamsTeamRestoredEvent(handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for TeamsTeamUnarchived events, such as for when a team is unarchived. * @param handler * @returns A promise that represents the work queued. */ onTeamsTeamUnarchivedEvent(handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise): this; /** * Runs the _event_ sub-type handlers, as appropriate, and then continues the event emission process. * * @param 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. */ protected dispatchEventActivity(context: TurnContext): Promise; /** * 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. * * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsMeetingStart(context: TurnContext): Promise; /** * 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. * * @param context The context for this turn. * @returns A promise that represents the work queued. */ protected onTeamsMeetingEnd(context: TurnContext): Promise; /** * Registers a handler for when a Teams meeting starts. * * @param handler A callback that handles Meeting Start events. * @returns A promise that represents the work queued. */ onTeamsMeetingStartEvent(handler: (meeting: MeetingStartEventDetails, context: TurnContext, next: () => Promise) => Promise): this; /** * Registers a handler for when a Teams meeting ends. * * @param handler A callback that handles Meeting End events. * @returns A promise that represents the work queued. */ onTeamsMeetingEndEvent(handler: (meeting: MeetingEndEventDetails, context: TurnContext, next: () => Promise) => Promise): this; } //# sourceMappingURL=teamsActivityHandler.d.ts.map