Closing the Microsoft Teams task module popup automatically - microsoft-teams

We are trying out messaging extensions capability in our Microsoft Teams App that has a command which fetch dynamic set of parameters from the bot when invoked from the compose box.
When the user clicks the messaging extension our app receives payload type 'invoke' and name as 'composeExtension/fetchTask'
Our app process the data and in return it responds with a Adaptive card in task with 'type':'continue' and the Adaptive card is having a link to open URL as below
"task": {
"type": "continue",
"value": {
"card": {
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [{
"type": "ActionSet",
"actions": [{
"type": "Action.OpenUrl",
"title": "Open Facebook",
"url": <URL to open Facebook>
}],
}
]
}
}
}
}
MSTeams shows this card in a task module popup window. When the User click the Action button it open the Facebook page in a new browser tab but the task module popup window is not closed.
Is there anyway to close the task module popup window when the user clicks the Action button ?
Note : We are not using Bot Framework SDK and Microsoft Teams Javascript client SDK.

The only way I know of to do two things on one user action is by using a web based task module.
Do some simple layout with a button. In the click handler use window.open(, "_blank") and when that completes call the microsoftTeams.tasks.submitTask(...) method of the javascript SDK.

this might be late.
But the documentation is wrong try to call the submitTask(data) twice once with data and once without any params submitTask() to close the taskmodule.

Related

Adaptive card sends error message when using ToggleVisibility action in MS Teams desktop app

This morning we started getting the standard bot error message in MS teams desktop client when using a card with toggleVisbility actions. Selecting the button to toggle visbility on part of the card results in the below error, even though the toggle works as expected!
bot error message
The adaptive card code looks something like this:
{
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "Alerts",
"targetElements": [
"Incidents",
{
"elementId": "Metrics",
"isVisible": false
},
{
"elementId": "Admin",
"isVisible": false
}
]
},
{
"type": "Action.ToggleVisibility",
"title": "Actions",
"targetElements": [
"ActionButton"
]
}
]
}
This message would be expected if the bot app doesn't respond to a message/action, however the toggle action shouldn't be sending any data to the bot applicaiton. I confirmed this in the teams web client using the network tracing dev tool. When selecting the toggle action no new network calls are made.
We are not seeing this error in either the web client or the mobile client, only in Teams Desktop app.
This bot has been running for months without this issue and we didn't change the code, which makes me believe this is a MS teams side bug that was recently introduced.
Also: This same issue was independently identified in the Adaptive Cards Project.
https://github.com/microsoft/AdaptiveCards/issues/8145

Webex Bot framework how to show user selected button text

I'm using MS Teams bot and Webex teams bot, I have some Adaptive-Card buttons on my bot message and I want to know which Adaptive Card button is pressed, by wrting it as a user message.
In MS Teams I can do that:
{
"type": "Action.Submit",
"title": "Click me for imBack",
"data": {
"msteams": {
"type": "imBack",
"value": "Text to reply in chat"
}
}
}
How can I do it in webex? I cannot find any documentaion talking about it
You can make use of the Bot Builder Community Webex Adapter. There is also a sample that shows how to use it (C# linked).

How to fix messages_tab_disabled error in Slack's chat.postMessage API?

I'm trying to post a direct message to a specific Slack user. I'm using chat.postMethod method. The below example works fine when channel is a channel ID. But when I change it to a users ID (as described in this documentation), I get back a messages_tab_disabled error.
POST URL: https://slack.com/api/chat.postMessage
{
"channel": "U02F7EXXXXX",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello"
}
}
]
}
I get back...
{
"ok": false,
"error": "messages_tab_disabled"
}
I can't find much on this other than a description on the documentation page that just says "Messages tab for the app is disabled.".
Where is it and how do I enable it?
I stumbled upon how to fix this when I was poking around settings for my app. In case this helps anyone else in the future...
In your apps configuration page, under Features > App Home, scroll down to the Show Tabs section and there is an option called Messages Tab that is off by default. I turned it on and now I can message users directly.

Dynamic typeahead in Adaptive Card Task flow

I'm trying to implement the dynamic typeahead search as was shown on the below resources:
https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/dynamic-search?tabs=desktop%2Ccsharp
https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-type-ahead-search-adaptive-cards/csharp
I'm having the following Adaptive Card returned from the OnTeamsMessagingExtensionFetchTaskAsync (from message action):
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"id": "choiceSelect",
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Choice 1",
"value": "Choice 1"
},
{
"title": "Choice 2",
"value": "Choice 2"
}
],
"placeholder": "Placeholder text",
"style": "filtered",
"choices.data": {
"type": "Data.Query",
"dataset": "cases"
}
}
]
}
Card is rendered correctly, but when I start typing, I'm getting the following results:
No request is being made. I was trying to debug the JS, but it is troublesome for me - I couldn't pinpoint the exact place it fails, but got these symbols to lookup: executeSearchInvoke, enableAppPermissionEnforcement and enableTenantSettingsForBots in 3.2-app.min.js.
Can anyone point me in the right direction? Is there some kind of dependency or permission I should add to the bot? Some setting in Teams Admin Center? I can add that static typeahead works flawlessly, but I need the dynamic one (big data collection to query).
EDIT:
I have confirmed that the app is added to the team (it is visible on the list of apps in team settings); I've removed and added it again just in case. I am still getting the same results.
List of permissions visible from the App details page:
This app will have permission to:
Receive messages and data that I provide to it.
Send me messages and notifications.
Access my profile information such as my name, email address, company name, and preferred language.
Receive messages and data that team members provide to it in a channel.
Send messages and notifications in a channel.
Access this team's information such as team name, channel list and roster (including team member's names and email addresses) - and use this to contact them​.

Integrating Microsoft team into my web app

I have a web app where if a user signs up, a notification is sent to the slack channel. I want to achieve the same thing in Microsoft team but I cant find any good resources. When a new user signs up, a message will be posted into the microsoft team group.Will it be possible to do this?
This can be easily achieved in Microsoft Teams using Connectors.
Here are the steps to post data to any channel:
In Microsoft Teams, choose the More options (⋯) button next to the
channel name in the list of channels and then choose Connectors.
Add an Incoming webhook and copy the webhook URL.
You can post Message Card given below to this URL using
Postman/Fiddler/Code.
{
"summary": "Alert!",
"themeColor": "0078D7",
"sections": [
{
"activityTitle": "Web app event",
"text": "Something happened in the web app!"
}],
"potentialAction": [
{
"#type": "OpenUri",
"name": "View event",
"targets": [
{ "os": "default", "uri": "http://mywebapp.com/path/to/event" }]
}]
}
You can also Build your own Connector with custom configurations.

Resources