Incoming Webhook for Microsoft Teams - Add to Planner (Task) Tab - microsoft-teams

Is there any way to create a new task within a Planner (Task) tab within a channel by using webhooks?
Either directly or having a button on the incoming message that then creates the task once the end user presses it?
I'm new to webhooks but having a look on Google, Power Automate is a way of doing it but not sure we have access to that.
I think I went down the wrong rabbit hole of task modules as I want to use what's already configured within the Planner tab and not create something bespoke. The button also doesn't work, comes up with an error message saying "This card action is disabled because it is not supported for Connectors". But this is what I have at the moment:
{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "Container",
"id": "066de76b-17da-e6f7-8ab3-81d36d8a6162",
"padding": "None",
"items": [
{
"type": "FactSet",
"id": "10eebecd-851c-2080-24f4-9b6044821d90",
"facts": [
{
"title": "**ID**",
"value": "EXAMPLE ID"
},
{
"title": "**Name**",
"value": "EXAMPLE NAME"
}
]
}
]
},
{
"type": "Container",
"id": "879303cd-81de-618a-8e99-e66be9f22ac1",
"padding": "None",
"items": [
{
"type": "TextBlock",
"id": "0833d313-657b-b587-d4d3-f4a961e6434a",
"text": "EXAMPLE ERROR MESSAGE.",
"wrap": true
},
{
"type": "Container",
"id": "de1d9a46-b8d4-443a-5afc-8843c445cf7b",
"padding": "None",
"items": [
{
"type": "ActionSet",
"id": "3b0c8763-dba8-3d88-98f5-7189ced1fe60",
"actions": [
{
"type": "Action.Submit",
"id": "btnCreateTask",
"title": "Create Task",
"card": {
"type": "AdaptiveCard",
"padding": "None",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
}
]
}
]
}
]
}
]
}
}
]
}
Thanks in advance for any help/suggestions

Related

Teams bot framework - composeExtensions does not display buttons on adaptive card

Two compose extension commands are defined in the manifest. These trigger a request to bot framework, which responds with an adaptive card.
When the adaptive card is displayed, it's rendered correctly except the button is missing. If I send the exact same adaptive card as a chat activity, it displays correctly.
handleTeamsMessagingExtensionFetchTask Code
// enableInboundCard = below json
const card = this.renderAdaptiveCard(enableInboundCard, { channel })
return {
task: {
type: 'continue',
value: {
card,
height: 500,
title: 'Enable Inbound',
width: 600
}
}
};
Command (in manifest).
{
"id": "enableInbound",
"context": [
"compose"
],
"description": "Enable inbound SMS to channel",
"title": "Enable Inbound",
"type": "action",
"fetchTask": true,
"parameters": [
{
"name": "test",
"title": "test",
"inputType": "text",
"value": "test"
}
]
}
Adaptive Card
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"wrap": true,
"style": "heading",
"text": "Enable Inbound SMS"
},
{
"type": "TextBlock",
"text": "A wholeeeeeeee bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch of txt",
"wrap": true
},
{
"type": "FactSet",
"facts": [
{
"title": "Current Channel",
"value": "${channel}"
}
]
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Execute",
"title": "Enable Inbound SMS",
"verb": "enable_inbound",
"fallback": "Action.Submit"
}
]
}
]
}

VSC validation with $schema and usage of additionalProperties = false

i have a dataobject.json and a corresponding example.json. I like to compare both if everything what is in the example is the same notation as in the dataobject.
I added in the exampe the dataobject file as a schema to validate against. This works, but only for the required field, not for the optional properties. - there the validation doesn't find a problem, even if there are some.
To validate these I added the "additionalProperties": false line. This works in general, so I find all the deviations, but I also get a problem that property §schema is not allowed.
How can I solve this?
the dataobject
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "GroupDO",
"required": [
"id",
"name"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"format": "uuid",
"example": "5dd6c80a-3376-4bce-bc47-8t41b3565325",
"description": "Unique id ."
},
"name": {
"type": "string",
"example": "ABD",
"description": "The name."
},
"GroupSort": {
"type": "integer",
"format": "int32",
"example": 1,
"description": "Defines in which order the groups should appear."
},
"GroupTextList": {
"type": "array",
"description": "A descriptoin in multiple languages.",
"items": {
"$ref": "../../common/dataobjects/Description_1000_DO.json"
}
},
"parentGroupId": {
"type": "string",
"format": "uuid",
"example": "8e590f93-1ab6-40e4-a5f4-aa1eeb2b6a80",
"description": "Unique id for the parent group."
}
},
"description": "DO representing a group object. "}
the example
{ "$schema": "../dataobjects/GroupDO.json",
"id": "18694b46-0833-4790-b780-c7897ap08500",
"version": 1,
"lastChange": "2020-05-12T13:57:39.935305",
"sort": 3,
"name": "STR",
"parentGroupId": "b504273e-61fb-48d1-aef8-c289jk779709",
"GroupTexts": [
{
"id": "7598b668-d9b7-4d27-a489-19e45h2bdad0",
"version": 0,
"lastChange": "2020-03-09T14:14:25.491787",
"languageIsoCode": "de_DE",
"description": "Tasche"
},
{
"id": "376e82f8-837d-4bb2-a21f-a9e0ebd59e23",
"version": 0,
"lastChange": "2020-03-09T14:14:25.491787",
"languageIsoCode": "en_GB",
"description": "Bag"
}
]
}
the problem messages:
property $schema is not allowed
Thanks in advance for your help.

How to display images in imageset dynamically from an array object in adaptiev cards?

I have an array object like this:
{
"Items":[
{
"ShortName":"Product short name",
"Image":"https://www.andrew.cmu.edu/user/cfperron/cats/images/cat8.jpg",
"ManufacturerName":"MMM",
"CatalogName":"cats"
},
{
"ShortName":"Product2 short name",
"Image":"https://www.andrew.cmu.edu/user/cfperron/cats/images/cat7.jpg",
"ManufacturerName":"SSS",
"CatalogName":"Dogs"
}
]
}
how to get Images in ImageSet dynamically in adaptive cards? I was able to get rest of the values in FactSet. But stuck with images.
Ok I figured it out.
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "medium",
"weight": "bolder",
"text": "Search Results"
},
{
"type": "Container",
"items": [
{
"type": "ImageSet",
"imageSize": "medium",
"images": [
{
"type": "Image",
"url": "${Image}",
"size": "Medium"
}
]
},
{
"type": "FactSet",
"facts": [
{
"title": "Short Name",
"value": "${ShortName}"
},
{
"title": "Supplier Name",
"value": "${SupplierName} "
},
{
"title": "Price ",
"value": "${PriceAmount} "
}
]
}
],
"$data": "${$root['Items']}"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2"
}
But next issue I am facing is if image url is empty, it throws an error "Adaptive Card Rendered error:
{
"message": "Cannot read property 'style' of null"
}"
How can we give a null check inside adaptive card for Image property?

How to display adaptive card selected option as if the user typed it in?

By default when we use adaptive cards in a waterfall dialog, the bot records the selected action and process the next waterfall step -
how it actually looks
Instead can we display the selected option in the adaptive card as if the user typed in the option like -
What I want it to look like
I have a requirement where we want to display it as if the user typed it in and not like the bot says "you selectd X option".
You can do this by using the 'data' property in your Adaptive Card.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"spacing": "medium",
"size": "small",
"weight": "bolder",
"text": "",
"wrap": true,
"maxLines": 0
},
{
"type": "Container"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Policy",
"data": "Policy"
},
{
"type": "Action.Submit",
"title": "Scheduled",
"data": "Scheduled"
}
]
}

Logic App deployment from Visual Studio 2017 fails

I have created a Logic App in Azure which works fine in Azure itself. So I first recreated the Logic App within VS2017 (with "Azure Logic Apps for Visual Studio" extension installed). The logic app contains a trigger to read from the Azure Servicebus and calls a custom logic app connector action. This custom connector calls a SOAP webservice via an Azure Data Gateway, which runs fine.
Now the issue is that when I try to deploy it from VS2017, it complains in the Output window. The message I get is:
New-AzureRmResourceGroupDeployment : 13:41:34 - Resource MICROSOFT.WEB/CONNECTIONS 'MyCustomConnector' failed with message '{"error": {"code": "ConnectionGatewayFailure","message": "Establishing connection with the service failed with code 'BadRequest'."}}'
My Logic App works great because I receive the SOAP request in my on-premise application.
What I have tried so far:
Checked my permissions, I am now owner of the resource groups (one where the Logic App and custom connector resides in, and one where the Gateway resides in)
Copied content in: "My resource group > Settings > Automation script > Json Template" and pasted it into Visual Studio
Run Visual Studio as Administrator
Added "-DeploymentDebugLogLevel All" to my Deploy-AzureResourceGroup.ps1 file, doesn't show me anything more useful.
Troubleshoot common Azure deployment errors which says for BadRequest: "You sent deployment values that do not match what is expected by Resource Manager. Check the inner status message for help with troubleshooting." I see no inner status message.
Checked Google for a useful answer
But up until now, without success. So hopefully some of you can help me.
Edit: Here's my ARM template, I renamed a few things, hopefully not too much.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connections_servicebus_name": {
"defaultValue": "servicebus",
"type": "String"
},
"customApis_MyCustomConnector_name": {
"defaultValue": "My-Custom-Connector",
"type": "String"
},
"connections_MyCustomConnector_name": {
"defaultValue": "My-Custom-Connector",
"type": "String"
},
"workflows_MyLogicApp_name": {
"defaultValue": "My-LogicApp",
"type": "String"
},
"workflows_MyLogicApp_id": {
"defaultValue": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Logic/integrationAccounts/My-Integration-Account",
"type": "String"
}
},
"variables": {},
"resources": [
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Logic/workflows/My-LogicApp'.",
"type": "Microsoft.Logic/workflows",
"name": "[parameters('workflows_MyLogicApp_name')]",
"apiVersion": "2017-07-01",
"location": "westeurope",
"tags": {},
"scale": null,
"properties": {
"state": "Enabled",
"integrationAccount": {
"id": "[parameters('workflows_MyLogicApp_id')]"
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
},
"actions": {
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"My-Custom-Connector": {
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('connections_MyCustomConnector_name'))]",
"connectionName": "My-Custom-Connector",
"id": "[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]"
},
"servicebus": {
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('connections_servicebus_name'))]",
"connectionName": "servicebus",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westeurope/managedApis/servicebus"
}
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('connections_MyCustomConnector_name'))]",
"[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]",
"[resourceId('Microsoft.Web/connections', parameters('connections_servicebus_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Web/connections/My-Custom-Connector'.",
"type": "Microsoft.Web/connections",
"name": "[parameters('connections_MyCustomConnector_name')]",
"apiVersion": "2016-06-01",
"location": "westeurope",
"scale": null,
"properties": {
"displayName": "LogicAppsCustomConnector-Connection",
"customParameterValues": {},
"api": {
"id": "[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Web/connections/servicebus'.",
"type": "Microsoft.Web/connections",
"name": "[parameters('connections_servicebus_name')]",
"apiVersion": "2016-06-01",
"location": "westeurope",
"scale": null,
"properties": {
"displayName": "worker_outbound",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westeurope/managedApis/', parameters('connections_servicebus_name'))]"
}
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Web/customApis/My-Custom-Connector'.",
"type": "Microsoft.Web/customApis",
"name": "[parameters('customApis_MyCustomConnector_name')]",
"apiVersion": "2016-06-01",
"location": "westeurope",
"scale": null,
"properties": {
"connectionParameters": {
"authType": {
"type": "string",
"allowedValues": [
{
"value": "none"
}
],
"uiDefinition": {
"displayName": "Authentication Type",
"description": "Authentication type to connect to your API",
"tooltip": "Authentication type to connect to your API",
"constraints": {
"tabIndex": 1,
"required": "true",
"allowedValues": [
{
"text": "none",
"value": "anonymous"
}
],
"capability": [
"gateway"
]
}
}
},
"gateway": {
"type": "gatewaySetting",
"gatewaySettings": {
"dataSourceType": "CustomConnector",
"connectionDetails": []
},
"uiDefinition": {
"constraints": {
"tabIndex": 4,
"required": "true",
"capability": [
"gateway"
]
}
}
}
},
"brandColor": "#ffffff",
"description": "Calls My SOAP test webservice.",
"displayName": "[parameters('customApis_MyCustomConnector_name')]",
"iconUri":
},
"dependsOn": []
}
]
}

Resources