TeamsActivityHandler Class

Inheritance
TeamsActivityHandler

Constructor

TeamsActivityHandler()

Methods

on_conversation_update_activity

Invoked when a conversation update activity is received from the channel. Conversation update activities are useful when it comes to responding to users being added to or removed from the channel. For example, a bot could respond to a user being added by greeting the user.

on_event_activity

Invoked when an event activity is received from the connector when the base behavior of <xref:botbuilder.core.teams.TeamsActivityHandler.on_turn> is used.

on_invoke_activity

Invoked when an invoke activity is received from the connector. Invoke activities can be used to communicate many different things.

on_sign_in_invoke

Invoked when a signIn invoke activity is received from the connector.

on_teams_app_based_link_query

Invoked when an app based link query activity is received from the connector.

on_teams_card_action_invoke

Invoked when an card action invoke activity is received from the connector.

on_teams_channel_created

Invoked when a Channel Created event activity is received from the connector. Channel Created correspond to the user creating a new channel.

on_teams_channel_deleted

Invoked when a Channel Deleted event activity is received from the connector. Channel Deleted correspond to the user deleting an existing channel.

on_teams_channel_renamed

Invoked when a Channel Renamed event activity is received from the connector. Channel Renamed correspond to the user renaming an existing channel.

on_teams_channel_restored

Invoked when a Channel Restored event activity is received from the connector. Channel Restored correspond to the user restoring a previously deleted channel.

on_teams_file_consent

Invoked when a file consent card activity is received from the connector.

activity sent when the user acts on a file consent card.

on_teams_file_consent_accept

Invoked when a file consent card is accepted by the user.

activity sent when the user accepts a file consent card.

on_teams_file_consent_decline

Invoked when a file consent card is declined by the user.

activity sent when the user declines a file consent card.

on_teams_meeting_end_event

Override this in a derived class to provide logic for when a Teams meeting end event is received.

on_teams_meeting_start_event

Override this in a derived class to provide logic for when a Teams meeting start event is received.

on_teams_members_added

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.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

on_teams_members_added_dispatch

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. It will get the associated members with the provided accounts.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

on_teams_members_removed

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.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

on_teams_members_removed_dispatch

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. It will get the associated members with the provided accounts.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

on_teams_messaging_extension_bot_message_preview_edit

Invoked when a messaging extension bot message preview edit activity is received from the connector.

on_teams_messaging_extension_bot_message_preview_send

Invoked when a messaging extension bot message preview send activity is received from the connector.

on_teams_messaging_extension_card_button_clicked

Override this in a derived class to provide logic for when a card button is clicked in a messaging extension.

on_teams_messaging_extension_configuration_query_settings_url

Invoked when a messaging extension configuration query setting url activity is received from the connector.

on_teams_messaging_extension_configuration_setting

Override this in a derived class to provide logic for when a configuration is set for a messaging extension.

on_teams_messaging_extension_fetch_task

Invoked when a Messaging Extension Fetch activity is received from the connector.

on_teams_messaging_extension_query

Invoked when a Messaging Extension Query activity is received from the connector.

on_teams_messaging_extension_select_item

Invoked when a messaging extension select item activity is received from the connector.

on_teams_messaging_extension_submit_action

Invoked when a messaging extension submit action activity is received from the connector.

on_teams_messaging_extension_submit_action_dispatch

Invoked when a messaging extension submit action dispatch activity is received from the connector.

on_teams_o365_connector_card_action

Invoked when a O365 Connector Card Action activity is received from the connector.

on_teams_signin_token_exchange
on_teams_signin_verify_state

Invoked when a signIn verify state activity is received from the connector.

on_teams_tab_fetch

Override this in a derived class to provide logic for when a tab is fetched.

on_teams_tab_submit

Override this in a derived class to provide logic for when a tab is submitted.

on_teams_task_module_fetch

Override this in a derived class to provide logic for when a task module is fetched.

on_teams_task_module_submit

Override this in a derived class to provide logic for when a task module is submitted.

on_teams_team_archived

Invoked when a Team Archived event activity is received from the connector. Team Archived correspond to the user archiving a team.

on_teams_team_deleted

Invoked when a Team Deleted event activity is received from the connector. Team Deleted corresponds to the user deleting a team.

on_teams_team_hard_deleted

Invoked when a Team Hard Deleted event activity is received from the connector. Team Hard Deleted corresponds to the user hard deleting a team.

on_teams_team_renamed

Invoked when a Team Renamed event activity is received from the connector. Team Renamed correspond to the user renaming an existing team.

on_teams_team_renamed_activity

DEPRECATED. Please use on_teams_team_renamed(). This method will remain in place throughout v4 so as not to break existing bots.

Invoked when a Team Renamed event activity is received from the connector. Team Renamed correspond to the user renaming an existing team.

on_teams_team_restored

Invoked when a Team Restored event activity is received from the connector. Team Restored corresponds to the user restoring a team.

on_teams_team_unarchived

Invoked when a Team Unarchived event activity is received from the connector. Team Unarchived correspond to the user unarchiving a team.

on_conversation_update_activity

Invoked when a conversation update activity is received from the channel. Conversation update activities are useful when it comes to responding to users being added to or removed from the channel. For example, a bot could respond to a user being added by greeting the user.

async on_conversation_update_activity(turn_context: TurnContext)

Parameters

Name Description
turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

Remarks

In a derived class, override this method to add logic that applies to all conversation update activities.

on_event_activity

Invoked when an event activity is received from the connector when the base behavior of <xref:botbuilder.core.teams.TeamsActivityHandler.on_turn> is used.

async on_event_activity(turn_context: TurnContext)

Parameters

Name Description
turn_context
Required

The context object for this turn

Returns

Type Description

A task that represents the work queued to execute

Remarks

When the <xref:botbuilder.core.teams.TeamsActivityHandler.on_turn> method receives an event activity, it calls this method. If the activity name is tokens/response, it calls <xref:botbuilder.core.teams.TeamsActivityHandler.on_token_response_event>; otherwise, it calls <xref:botbuilder.core.teams.TeamsActivityHandler.on_event>.

In a derived class, override this method to add logic that applies to all event activities. Add logic to apply before the specific event-handling logic before the call to this base class method. Add logic to apply after the specific event-handling logic after the call to this base class method.

Event activities communicate programmatic information from a client or channel to a bot. The meaning of an event activity is defined by the event activity name property, which is meaningful within the scope of a channel.

on_invoke_activity

Invoked when an invoke activity is received from the connector. Invoke activities can be used to communicate many different things.

async on_invoke_activity(turn_context: TurnContext) -> InvokeResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

Returns

Type Description

An InvokeResponse that represents the work queued to execute.

Remarks

Invoke activities communicate programmatic commands from a client or channel to a bot. The meaning of an invoke activity is defined by the "invoke_activity.name" property, which is meaningful within the scope of a channel.

on_sign_in_invoke

Invoked when a signIn invoke activity is received from the connector.

async on_sign_in_invoke(turn_context: TurnContext)

Parameters

Name Description
turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

Invoked when an app based link query activity is received from the connector.

async on_teams_app_based_link_query(turn_context: TurnContext, query: AppBasedLinkQuery) -> MessagingExtensionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

query
Required

The invoke request body type for app-based link query.

Returns

Type Description

The Messaging Extension Response for the query.

on_teams_card_action_invoke

Invoked when an card action invoke activity is received from the connector.

async on_teams_card_action_invoke(turn_context: TurnContext) -> InvokeResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

Returns

Type Description

An InvokeResponse that represents the work queued to execute.

on_teams_channel_created

Invoked when a Channel Created event activity is received from the connector. Channel Created correspond to the user creating a new channel.

async on_teams_channel_created(channel_info: ChannelInfo, team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
channel_info
Required

The channel info object which describes the channel.

team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_channel_deleted

Invoked when a Channel Deleted event activity is received from the connector. Channel Deleted correspond to the user deleting an existing channel.

async on_teams_channel_deleted(channel_info: ChannelInfo, team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
channel_info
Required

The channel info object which describes the channel.

team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_channel_renamed

Invoked when a Channel Renamed event activity is received from the connector. Channel Renamed correspond to the user renaming an existing channel.

async on_teams_channel_renamed(channel_info: ChannelInfo, team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
channel_info
Required

The channel info object which describes the channel.

team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_channel_restored

Invoked when a Channel Restored event activity is received from the connector. Channel Restored correspond to the user restoring a previously deleted channel.

async on_teams_channel_restored(channel_info: ChannelInfo, team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
channel_info
Required

The channel info object which describes the channel.

team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

Invoked when a file consent card activity is received from the connector.

activity sent when the user acts on a file consent card.

async on_teams_file_consent(turn_context: TurnContext, file_consent_card_response: FileConsentCardResponse) -> InvokeResponse

Parameters

Name Description
turn_context
Required
file_consent_card_response
Required

Returns

Type Description

An InvokeResponse depending on the action of the file consent card.

Invoked when a file consent card is accepted by the user.

activity sent when the user accepts a file consent card.

async on_teams_file_consent_accept(turn_context: TurnContext, file_consent_card_response: FileConsentCardResponse)

Parameters

Name Description
turn_context
Required
file_consent_card_response
Required

Returns

Type Description

A task that represents the work queued to execute.

Invoked when a file consent card is declined by the user.

activity sent when the user declines a file consent card.

async on_teams_file_consent_decline(turn_context: TurnContext, file_consent_card_response: FileConsentCardResponse)

Parameters

Name Description
turn_context
Required
file_consent_card_response
Required

Returns

Type Description

A task that represents the work queued to execute.

on_teams_meeting_end_event

Override this in a derived class to provide logic for when a Teams meeting end event is received.

async on_teams_meeting_end_event(meeting: MeetingEndEventDetails, turn_context: TurnContext)

Parameters

Name Description
meeting
Required

The details of the meeting.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_meeting_start_event

Override this in a derived class to provide logic for when a Teams meeting start event is received.

async on_teams_meeting_start_event(meeting: MeetingStartEventDetails, turn_context: TurnContext)

Parameters

Name Description
meeting
Required

The details of the meeting.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_members_added

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.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

async on_teams_members_added(teams_members_added: [<class 'botbuilder.schema.teams._models_py3.TeamsChannelAccount'>], team_info: ~botbuilder.schema.teams._models_py3.TeamInfo, turn_context: ~botbuilder.core.turn_context.TurnContext)

Parameters

Name Description
teams_members_added
Required
team_info
Required
turn_context
Required

Returns

Type Description

A task that represents the work queued to execute.

on_teams_members_added_dispatch

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. It will get the associated members with the provided accounts.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

async on_teams_members_added_dispatch(members_added: [<class 'botbuilder.schema._models_py3.ChannelAccount'>], team_info: ~botbuilder.schema.teams._models_py3.TeamInfo, turn_context: ~botbuilder.core.turn_context.TurnContext)

Parameters

Name Description
members_added
Required
team_info
Required
turn_context
Required

Returns

Type Description

A task that represents the work queued to execute.

on_teams_members_removed

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.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

async on_teams_members_removed(teams_members_removed: [<class 'botbuilder.schema.teams._models_py3.TeamsChannelAccount'>], team_info: ~botbuilder.schema.teams._models_py3.TeamInfo, turn_context: ~botbuilder.core.turn_context.TurnContext)

Parameters

Name Description
teams_members_removed
Required
team_info
Required
turn_context
Required

Returns

Type Description

A task that represents the work queued to execute.

on_teams_members_removed_dispatch

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. It will get the associated members with the provided accounts.

described by the conversation update activity. :param team_info: The team info object representing the team. :param turn_context: A context object for this turn.

async on_teams_members_removed_dispatch(members_removed: [<class 'botbuilder.schema._models_py3.ChannelAccount'>], team_info: ~botbuilder.schema.teams._models_py3.TeamInfo, turn_context: ~botbuilder.core.turn_context.TurnContext)

Parameters

Name Description
members_removed
Required
team_info
Required
turn_context
Required

Returns

Type Description

A task that represents the work queued to execute.

on_teams_messaging_extension_bot_message_preview_edit

Invoked when a messaging extension bot message preview edit activity is received from the connector.

async on_teams_messaging_extension_bot_message_preview_edit(turn_context: TurnContext, action: MessagingExtensionAction) -> MessagingExtensionActionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

action
Required

The messaging extension action.

Returns

Type Description

The Messaging Extension Action Response for the action.

on_teams_messaging_extension_bot_message_preview_send

Invoked when a messaging extension bot message preview send activity is received from the connector.

async on_teams_messaging_extension_bot_message_preview_send(turn_context: TurnContext, action: MessagingExtensionAction) -> MessagingExtensionActionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

action
Required

The messaging extension action.

Returns

Type Description

The Messaging Extension Action Response for the action.

on_teams_messaging_extension_card_button_clicked

Override this in a derived class to provide logic for when a card button is clicked in a messaging extension.

async on_teams_messaging_extension_card_button_clicked(turn_context: TurnContext, card_data)

Parameters

Name Description
turn_context
Required

A context object for this turn.

card_data
Required

Object representing the card data.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_messaging_extension_configuration_query_settings_url

Invoked when a messaging extension configuration query setting url activity is received from the connector.

async on_teams_messaging_extension_configuration_query_settings_url(turn_context: TurnContext, query: MessagingExtensionQuery) -> MessagingExtensionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

query
Required

The Messaging extension query.

Returns

Type Description

The Messaging Extension Response for the query.

on_teams_messaging_extension_configuration_setting

Override this in a derived class to provide logic for when a configuration is set for a messaging extension.

async on_teams_messaging_extension_configuration_setting(turn_context: TurnContext, settings)

Parameters

Name Description
turn_context
Required

A context object for this turn.

settings
Required

Object representing the configuration settings.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_messaging_extension_fetch_task

Invoked when a Messaging Extension Fetch activity is received from the connector.

async on_teams_messaging_extension_fetch_task(turn_context: TurnContext, action: MessagingExtensionAction) -> MessagingExtensionActionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

action
Required

The messaging extension action.

Returns

Type Description

The Messaging Extension Action Response for the action.

on_teams_messaging_extension_query

Invoked when a Messaging Extension Query activity is received from the connector.

async on_teams_messaging_extension_query(turn_context: TurnContext, query: MessagingExtensionQuery) -> MessagingExtensionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

query
Required

The query for the search command.

Returns

Type Description

The Messaging Extension Response for the query.

on_teams_messaging_extension_select_item

Invoked when a messaging extension select item activity is received from the connector.

async on_teams_messaging_extension_select_item(turn_context: TurnContext, query) -> MessagingExtensionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

query
Required

The object representing the query.

Returns

Type Description

The Messaging Extension Response for the query.

on_teams_messaging_extension_submit_action

Invoked when a messaging extension submit action activity is received from the connector.

async on_teams_messaging_extension_submit_action(turn_context: TurnContext, action: MessagingExtensionAction) -> MessagingExtensionActionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

action
Required

The messaging extension action.

Returns

Type Description

The Messaging Extension Action Response for the action.

on_teams_messaging_extension_submit_action_dispatch

Invoked when a messaging extension submit action dispatch activity is received from the connector.

async on_teams_messaging_extension_submit_action_dispatch(turn_context: TurnContext, action: MessagingExtensionAction) -> MessagingExtensionActionResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

action
Required

The messaging extension action.

Returns

Type Description

The Messaging Extension Action Response for the action.

on_teams_o365_connector_card_action

Invoked when a O365 Connector Card Action activity is received from the connector.

async on_teams_o365_connector_card_action(turn_context: TurnContext, query: O365ConnectorCardActionQuery)

Parameters

Name Description
turn_context
Required

A context object for this turn.

query
Required

The O365 connector card HttpPOST invoke query.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_signin_token_exchange

async on_teams_signin_token_exchange(turn_context: TurnContext)

Parameters

Name Description
turn_context
Required

on_teams_signin_verify_state

Invoked when a signIn verify state activity is received from the connector.

async on_teams_signin_verify_state(turn_context: TurnContext)

Parameters

Name Description
turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_tab_fetch

Override this in a derived class to provide logic for when a tab is fetched.

async on_teams_tab_fetch(turn_context: TurnContext, tab_request: TabRequest)

Parameters

Name Description
turn_context
Required

A context object for this turn.

tab_request
Required

The tab invoke request value payload.

Returns

Type Description

A Tab Response for the request.

on_teams_tab_submit

Override this in a derived class to provide logic for when a tab is submitted.

async on_teams_tab_submit(turn_context: TurnContext, tab_submit: TabSubmit)

Parameters

Name Description
turn_context
Required

A context object for this turn.

tab_submit
Required

The tab submit invoke request value payload.

Returns

Type Description

A Tab Response for the request.

on_teams_task_module_fetch

Override this in a derived class to provide logic for when a task module is fetched.

async on_teams_task_module_fetch(turn_context: TurnContext, task_module_request: TaskModuleRequest) -> TaskModuleResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

task_module_request
Required

The task module invoke request value payload.

Returns

Type Description

A Task Module Response for the request.

on_teams_task_module_submit

Override this in a derived class to provide logic for when a task module is submitted.

async on_teams_task_module_submit(turn_context: TurnContext, task_module_request: TaskModuleRequest) -> TaskModuleResponse

Parameters

Name Description
turn_context
Required

A context object for this turn.

task_module_request
Required

The task module invoke request value payload.

Returns

Type Description

A Task Module Response for the request.

on_teams_team_archived

Invoked when a Team Archived event activity is received from the connector. Team Archived correspond to the user archiving a team.

async on_teams_team_archived(team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_team_deleted

Invoked when a Team Deleted event activity is received from the connector. Team Deleted corresponds to the user deleting a team.

async on_teams_team_deleted(team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_team_hard_deleted

Invoked when a Team Hard Deleted event activity is received from the connector. Team Hard Deleted corresponds to the user hard deleting a team.

async on_teams_team_hard_deleted(team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_team_renamed

Invoked when a Team Renamed event activity is received from the connector. Team Renamed correspond to the user renaming an existing team.

async on_teams_team_renamed(team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_team_renamed_activity

DEPRECATED. Please use on_teams_team_renamed(). This method will remain in place throughout v4 so as not to break existing bots.

Invoked when a Team Renamed event activity is received from the connector. Team Renamed correspond to the user renaming an existing team.

async on_teams_team_renamed_activity(team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_team_restored

Invoked when a Team Restored event activity is received from the connector. Team Restored corresponds to the user restoring a team.

async on_teams_team_restored(team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.

on_teams_team_unarchived

Invoked when a Team Unarchived event activity is received from the connector. Team Unarchived correspond to the user unarchiving a team.

async on_teams_team_unarchived(team_info: TeamInfo, turn_context: TurnContext)

Parameters

Name Description
team_info
Required

The team info object representing the team.

turn_context
Required

A context object for this turn.

Returns

Type Description

A task that represents the work queued to execute.