0
votes

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.

1
I don't think the Praise app is a bot. Is there a Praise bot that I'm unaware of, or are you just talking about the Praise app?Kyle Delaney
I want to point out some special behavior of the Praise app. When you type @praise and hit [enter] or [space], the task module will open. This means you don't even have to send a message. The Praise app will automatically open as soon as it detects its mention in the message you're typing. Not only that, your message will disappear and won't actually be sent to the conversation. This is different from how a bot is activated. For a bot, you have to send a message that mentions the bot to the conversation in order for the bot to respond. Which behavior do you want to achieve?Kyle Delaney
My thinking was that it was a bot, since it was invoked from a Teams channel discussion, but I guess that doesn't have to be the case. I'm trying to achieve the "app" behavior that you described above. Are task modules the way to go? It says task modules can be invoked in three ways: channel/tabs, bots, and deep links, then describes it for tabs - unsure how to invoke from a channel.siddarfer
Thanks for the answer thus far. I'll continue looking through the documentation and samples. In the meantime, bear in mind that the question is how to select and start the app as a modal dialog - the below seems to be about how to respond to the submit action. Also, it's unclear to me how to incorporate the below into a context.sendActivity method from BotFramework v4.siddarfer
I suspect the behavior you're looking for may come from messaging extensions: docs.microsoft.com/en-us/microsoftteams/platform/concepts/…Kyle Delaney

1 Answers

0
votes

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