question

MoshfiqurRahmanRony-3086 avatar image
0 Votes"
MoshfiqurRahmanRony-3086 asked JimmyYang-MSFT edited

MessagingExtensionActionResponse giving serializer error in python

Hi, I am developing an MS Teams app in my REST API. I am using Django Rest Framework. My bot is doing great untill I implemented on_teams_messaging_extension_fetch_task. When this function returns a MessagingExtensionActionResponse type it creates an error like below


'dict' object has no attribute 'serialize'

This is what my function look like

async def on_teams_messaging_extension_fetch_task(
        self, turn_context: TurnContext, action: MessagingExtensionAction
    ) -> MessagingExtensionActionResponse:
        print('I am on_teams_messaging_extension_fetch_task', turn_context.activity.value, action)
        # card = create_adaptive_card_editor()
        card = CardFactory.adaptive_card(
                {
                    "actions": [{"type": "Action.Submit", "title": "Close",}],
                    "body": [
                        {
                            "text": "You have been signed out.",
                            "type": "TextBlock",
                            "weight": "bolder",
                        },
                    ],
                    "type": "AdaptiveCard",
                    "version": "1.0",
                }
            )
        task_info = TaskModuleTaskInfo(
            card=card, height=450, title="Task Module Fetch Example", width=500
        )
        continue_response = TaskModuleContinueResponse(value=task_info)
        return MessagingExtensionActionResponse(task=continue_response)


Am I doing anything wrong? You can use this as a sample project.

office-teams-windows-itprooffice-teams-app-dev
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MoshfiqurRahmanRony-3086

Our forum is mainly focused on the general issue of Microsoft Teams troubleshooting. According to your description, your issue is more related to development, which we do not support. So I will remove teams tag and add teams-app-dev tag. Thanks for your understanding and patience!

1 Vote 1 ·

@MoshfiqurRahmanRony-3086

It has been a while, how is everything going?
If you have any update about this issue, please feel free to post back.

0 Votes 0 ·

We are working on it , we will update you soon.

1 Vote 1 ·

1 Answer

TanmaySarkar avatar image
0 Votes"
TanmaySarkar answered TanmaySarkar published

This is a sample code for using adaptive Card in Task module using Python, try this.
https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/python/54.teams-task-module/bots/teams_task_module_bot.py

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.