How to respond to botMessagePreview edit event when using a static list of parameters for your task module?

MostBlah 1 Reputation point
2022-11-28T15:50:26.473+00:00

Hi,

I created a task module for my Teams Message Extension using a static list of parameters. To accomplish this, I added a list of parameters to my app manifest like so:

"composeExtensions": [  
    {  
      "botId": "xxx",  
      "commands": [  
        {  
          "id": "New post",  
          "type": "action",  
          "title": "New Post",  
          "description": "Create a new post",  
          "context": [  
            "compose"  
          ],  
          "parameters": [  
            {  
              "name": "Name",  
              "title": "User Name",  
              "description": "The name of the poster",  
              "inputType": "text"  
            },  
            {  
              "name": "Post",  
              "title": "Post Body",  
              "description": "Enter the text of your post",  
              "inputType": "textarea"  
            }  
          ]  
        }  
      ]  
    }  
  ]  

This works as expected when I select my message extension by showing a form with the Name and Post fields. I respond to the initial composeExtension/submitAction with a card preview and that works as intended as well.

My issue is when I'm at the preview screen, if I hit edit, I don't know how to respond to the edit event. According to the documentation I should respond to the edit event by returning the task module I sent in response to the initial composeExtension/fetchTask invoke that began the interaction. This doesn't make sense though if my task module is based on a static list of parameters that are set in the app manifest. I never send a task module to begin with, I'm only responding to events.

My ideal behavior is when a user hits the edit button, they are taken back to the initial form of parameters that are listed in my app manifest. It seems however that the only valid responses to the edit event are either a card or a web view. Is there any way to respond to the edit event so that the user is taken back to the original form?

I tried responding with something like this but it does not work:

{  
  "task": {  
    "type": "continue",  
    "parameters": [  
      {  
        "name": "Name",  
        "title": "User Name",  
        "description": "The name of the poster",  
        "inputType": "text"  
      },  
      {  
        "name": "Post",  
        "title": "Post Body",  
        "description": "Enter the text of your post",  
        "inputType": "textarea"  
      }  
    ]  
  }  
}  

Additional context: I have a bot that I would like to respond to the submit action with an adaptive card as mentioned in the docs here. I'd prefer to skip the preview card but it seems like it's required when using a bot to respond with an adaptive card.

Any guidance or assistance is much appreciated!

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,295 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.