siddarfer
siddarfer

Reputation: 262

How to create a Teams app that starts with a modal dialog

I'm trying to create a Teams app, let's call it 'TestApp', such that when it's invoked from a Teams Channel via @TestApp [ENTER], a modal dialog will appear, allowing the user to set various options, then click OK when done.

So far I've been focusing on "task modules" from a Microsoft Teams bot - see: https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/task-modules/task-modules-bots - but I don't understand how to set the "value" object of an invoke card action to type task/fetch when first starting the bot (or even if that's the right approach for a Teams app). I can sort of see how an adaptive card could be returned as a response, containing a button for invoking the task module, but don't see how to do it initially. I've loaded 'TaskModule.zip' - see: https://github.com/OfficeDev/microsoft-teams-sample-task-module-nodejs - into my Teams, but that doesn't initially start as a modal dialog.

For an example of what I'm trying to achieve, see how the @praise bot starts up. After typing @praise [ENTER], a modal dialog appears - that's what I'm trying to achieve.

Upvotes: 0

Views: 1948

Answers (1)

Wajeed Shaikh
Wajeed Shaikh

Reputation: 3168

Here is the documentation on how to Respond with an adaptive card message sent from a bot.

Sample JSON:

{
  "composeExtension": {
    "type": "botMessagePreview",
    "activityPreview": {
      "type": "message",
      "attachments":  [
        {
          "contentType": "application/vnd.microsoft.card.adaptive",
          "content": << Card Payload >>
        }
      ]
    }
  }
}

Your message extension will now need to respond to two new types of interactions, value.botMessagePreviewAction = "send" and value.botMessagePreviewAction = "edit".

Please go through the documentation. You can raise such issues directly on respective documentation page. enter image description here

Upvotes: 0

Related Questions