-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Bug Description
When you use the custom feedback forms by overruling the ChannelData you get the following exception:
2026-03-25T19:56:32.7102626Z stdout F invoke
2026-03-25T19:56:32.7103337Z stdout F Input tag 'message/fetchTask' found using 'name' does not match any of the expected tags: 'fileConsent/invoke', 'actionableMessage/executeAction', 'composeExtension/anonymousQueryLink', 'composeExtension/onCardButtonClicked', 'composeExtension/fetchTask', 'composeExtension/query', 'composeExtension/queryLink', 'composeExtension/querySettingUrl', 'composeExtension/selectItem', 'composeExtension/setting', 'composeExtension/submitAction', 'config/fetch', 'config/submit', 'tab/fetch', 'tab/submit', 'task/fetch', 'task/submit', 'message/submitAction', 'handoff/action', 'signin/tokenExchange', 'signin/verifyState', 'signin/failure', 'adaptiveCard/action' [type=union_tag_invalid, input_value={'name': 'message/fetchTa...ne': 'Europe/Amsterdam'}, input_type=dict]
2026-03-25T19:56:32.7103396Z stdout F For further information visit https://errors.pydantic.dev/2.11/v/union_tag_invalid
2026-03-25T19:56:32.7135152Z stderr F ERROR: Exception in ASGI application
2026-03-25T19:56:32.7135523Z stderr F Traceback (most recent call last):
2026-03-25T19:56:32.7135716Z stderr F File "/usr/local/lib/python3.13/site-packages/microsoft_teams/apps/auth/jwt_middleware.py", line 63, in middleware
2026-03-25T19:56:32.7135742Z stderr F return await call_next(request)
2026-03-25T19:56:32.7135761Z stderr F ^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-25T19:56:32.7135779Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 168, in call_next
2026-03-25T19:56:32.7135799Z stderr F raise app_exc from app_exc.cause or app_exc.context
2026-03-25T19:56:32.7135820Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 144, in coro
2026-03-25T19:56:32.7135839Z stderr F await self.app(scope, receive_or_disconnect, send_no_error)
2026-03-25T19:56:32.7135859Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 63, in call
2026-03-25T19:56:32.7135879Z stderr F await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2026-03-25T19:56:32.7135900Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2026-03-25T19:56:32.7135937Z stderr F raise exc
2026-03-25T19:56:32.7135957Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2026-03-25T19:56:32.7136337Z stderr F await app(scope, receive, sender)
2026-03-25T19:56:32.7136373Z stderr F File "/usr/local/lib/python3.13/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call
2026-03-25T19:56:32.7136397Z stderr F await self.app(scope, receive, send)
2026-03-25T19:56:32.7136416Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 716, in call
2026-03-25T19:56:32.7136435Z stderr F await self.middleware_stack(scope, receive, send)
2026-03-25T19:56:32.7136454Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 736, in app
2026-03-25T19:56:32.7136472Z stderr F await route.handle(scope, receive, send)
2026-03-25T19:56:32.7136490Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 290, in handle
2026-03-25T19:56:32.7136519Z stderr F await self.app(scope, receive, send)
2026-03-25T19:56:32.7136538Z stderr F File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 115, in app
2026-03-25T19:56:32.7136556Z stderr F await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2026-03-25T19:56:32.7136573Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2026-03-25T19:56:32.7137167Z stderr F raise exc
2026-03-25T19:56:32.7137345Z stderr F File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2026-03-25T19:56:32.7137372Z stderr F await app(scope, receive, sender)
2026-03-25T19:56:32.7137917Z stderr F File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 101, in app
2026-03-25T19:56:32.7137956Z stderr F response = await f(request)
2026-03-25T19:56:32.7137986Z stderr F ^^^^^^^^^^^^^^^^
2026-03-25T19:56:32.7138006Z stderr F File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 355, in app
2026-03-25T19:56:32.7138025Z stderr F raw_response = await run_endpoint_function(
2026-03-25T19:56:32.7138044Z stderr F ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-25T19:56:32.7138062Z stderr F ...<3 lines>...
2026-03-25T19:56:32.7138080Z stderr F )
2026-03-25T19:56:32.7138110Z stderr F ^
2026-03-25T19:56:32.7138130Z stderr F File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 243, in run_endpoint_function
2026-03-25T19:56:32.7138148Z stderr F return await dependant.call(**values)
2026-03-25T19:56:32.7138167Z stderr F ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-25T19:56:32.7138185Z stderr F File "/usr/local/lib/python3.13/site-packages/microsoft_teams/apps/http_plugin.py", line 369, in on_activity_request
2026-03-25T19:56:32.7138203Z stderr F result = await self._handle_activity_request(request)
2026-03-25T19:56:32.7138222Z stderr F ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-25T19:56:32.7138241Z stderr F File "/usr/local/lib/python3.13/site-packages/microsoft_teams/apps/http_plugin.py", line 323, in _handle_activity_request
2026-03-25T19:56:32.7138259Z stderr F activity = ActivityTypeAdapter.validate_python(body)
2026-03-25T19:56:32.7138557Z stderr F File "/usr/local/lib/python3.13/site-packages/pydantic/type_adapter.py", line 421, in validate_python
2026-03-25T19:56:32.7138668Z stderr F return self.validator.validate_python(
2026-03-25T19:56:32.7138801Z stderr F ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
2026-03-25T19:56:32.7138817Z stderr F object,
2026-03-25T19:56:32.7138829Z stderr F ^^^^^^^
2026-03-25T19:56:32.7138841Z stderr F ...<5 lines>...
2026-03-25T19:56:32.7138854Z stderr F by_name=by_name,
2026-03-25T19:56:32.7138865Z stderr F ^^^^^^^^^^^^^^^^
2026-03-25T19:56:32.7138878Z stderr F )
2026-03-25T19:56:32.7138889Z stderr F ^
2026-03-25T19:56:32.7139113Z stderr F pydantic_core._pydantic_core.ValidationError: 1 validation error for tagged-union[HandoffActivity,TraceActivity,TypingActivity,CommandSendActivity,CommandResultActivity,ConversationUpdateActivity,EndOfConversationActivity,MessageActivity,MessageDeleteActivity,MessageReactionActivity,MessageUpdateActivity,tagged-union[ReadReceiptEventActivity,MeetingStartEventActivity,MeetingEndEventActivity,MeetingParticipantJoinEventActivity,MeetingParticipantLeaveEventActivity],tagged-union[FileConsentInvokeActivity,ExecuteActionInvokeActivity,MessageExtensionAnonQueryLinkInvokeActivity,MessageExtensionCardButtonClickedInvokeActivity,MessageExtensionFetchTaskInvokeActivity,MessageExtensionQueryInvokeActivity,MessageExtensionQueryLinkInvokeActivity,MessageExtensionQuerySettingUrlInvokeActivity,MessageExtensionSelectItemInvokeActivity,MessageExtensionSettingInvokeActivity,MessageExtensionSubmitActionInvokeActivity,ConfigFetchInvokeActivity,ConfigSubmitInvokeActivity,TabFetchInvokeActivity,TabSubmitInvokeActivity,TaskFetchInvokeActivity,TaskSubmitInvokeActivity,MessageSubmitActionInvokeActivity,HandoffActionInvokeActivity,SignInTokenExchangeInvokeActivity,SignInVerifyStateInvokeActivity,SignInFailureInvokeActivity,AdaptiveCardInvokeActivity],tagged-union[InstalledActivity,UninstalledActivity]]
Steps to Reproduce
- Install the following dependencies:
- microsoft-teams-apps
- microsoft-teams-common
- microsoft-teams-cards
- when sending the message to the user:
msg =MessageActivityInput(
text="Mesage text",
channelData={
"feedbackLoop": {
"type": "custom", #<---- this is required for custom feedback forms
},
},
).add_ai_generated(),- When teams request the AdaptiveCard from the server:
async def _handle_invoke_activity(
self,
ctx: ActivityContext[InvokeActivity],
) -> TaskModuleInvokeResponse | None:
"""Handle Teams invoke activities, including custom feedback forms."""
activity_name = ctx.activity.name
if activity_name == "message/fetchTask":
return custom_feedback_form() # some kind of logic that return the custom feedback form.- Because the internal mechanism doesn't know
message/fetchTaskinvoke activity from the Teams Application the invoke logic is not being called.
Expected Behavior
- The
message/fetchTaskshould be an known invoke activity. - The add_feedback() function should also have the parameter option
customordefaultfor the different behaviors. So you can do something like this:
msg = MessageActivityInput(
text="Mesage text"
).add_ai_generated().add_feedback(mode="custom"),internal the library should set the channel data with the following information:
channelData={
"feedbackLoop": {
"type": "custom",
},
},Actual Behavior
you get an pydantic ValidationErro because message/fetchTask is unknown.
SDK Version
2.0.0a20
Python Version
3.12, 3.13
Additional Context
This function have been added before but somehow it is missing again look at the following issues within the teams-sdk:
[C#] feat: custom feedback form + citation changes #2278
[Dev support]: Custom feedback loops in .NET #2387