简体   繁体   中英

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://docs.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.

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. 在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM