MessagingExtensionActionResponse giving serializer error in python

Moshfiqur Rahman Rony 1 Reputation point
2021-06-24T10:22:07.533+00:00

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.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,629 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,065 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tanmay Sarkar 1 Reputation point
    2021-06-30T10:47:41.093+00:00

    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

    0 comments No comments