Unable to show the button in Microsoft Teams - json

For the json data below unable to show the button in Microsoft Team
but that is work fine in Outlook. Anyone can help me solve this ? ty
Pls refer to the photo link below .
{"#type": "MessageCard",
"title": "System Alert",
"text" : "Network Error",
"themeColor": "E81123",
"potentialAction": [
{
"#type": "ActionCard",
"name": "",
"inputs": [
{
"#type": "TextInput",
"id": "comment",
"title": "Enter your comment",
"isMultiline": "true"
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "OK",
"target": "https://ptsv2.com/t/ANA/post",
"body": "comment={{comment.value}}"
}
]
}
]
}
Microsoft Teams output
Outlook output

Please try putting in name value for action card ( "name": "ActionCardName" )
{"#type": "MessageCard",
"title": "System Alert",
"text" : "Network Error",
"themeColor": "E81123",
"potentialAction": [
{
"#type": "ActionCard",
"name": "ActionCardName",
"inputs": [
{
"#type": "TextInput",
"id": "comment",
"title": "Enter your comment",
"isMultiline": "true"
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "OK",
"target": "https://ptsv2.com/t/ANA/post",
"body": "comment={{comment.value}}"
}
]
}
]
}
You could MessageCard Playground to test this by using Send Via Webhook button.

Related

How to extend choice in adaptive card when option in ChoiceSet selected?

I have no idea how to use "Only show when" property in my ChoiceSet. I want "Version" ChoiceSet to be displayed when second option in the first ChoiceSet is selected. Maybe I need to save responce from the first ChoiceSet to a variable but I also have no idea how to do it.
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Online",
"value": "Online"
},
{
"title": "On-Premise",
"value": "OnPremise"
}
],
"placeholder": "Placeholder text",
"style": "expanded",
"id": "EnvironmentType"
},
{
"type": "TextBlock",
"text": "choose version",
"wrap": true
},
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "2019",
"value": "2019"
},
{
"title": "2016",
"value": "2016"
}
],
"placeholder": "Version",
"isVisible": false,
"id": "ChoiceSetId"
}
]
}

How can I find the JSON error in my DialogFlow request?

I am sending the following intent creation json to DialogFlow API hook and keep getting the error "JSON syntax error". Is there a way I can get a more detailed description of the error?
{
"templates": [],
"lastUpdate": 1508084934,
"fallbackIntent": "false",
"name": "address-intent",
"contexts": [
"order-intent-order-done-confirm-followup"
],
"auto": "true",
"webhookUsed": "true",
"events": [],
"priority": 500000,
"userSays": [
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "deliver to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "#sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "please deliver it to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "#sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "34 1st street",
"meta": "#sys.address",
"userDefined": "false",
"alias": "address"
}
]
},
{
"count": 0,
"isTemplate": "false",
"data": [
{
"text": "deliver it to ",
"userDefined": "false"
},
{
"text": "washington square",
"meta": "#sys.address",
"userDefined": "false",
"alias": "address"
}
]
}
],
"webhookForSlotFilling": "false",
"responses": [
{
"affectedContexts": [
{
"name": "address-intent-followup",
"parameters": {},
"lifespan": 1
}
],
"parameters": [
{
"name": "address",
"dataType": "#sys.address",
"required": "true",
"value": "$address",
"prompts": [
{
"lang": "en",
"value": "What's the address for the delivery?"
},
{
"lang": "en",
"value": "Where should we send the order to?"
},
{
"lang": "en",
"value": "What's your address?"
}
],
"isList": "false"
}
],
"messages": [
{
"lang": "en",
"speech": [],
"type": 0
}
],
"defaultResponsePlatforms": {},
"action": "address-intent",
"speech": [],
"resetContexts": "false"
}
]
}
To be clear, other intent creation requests work (as well as get requests) so I am pretty sure something in my JSON is wrong. The JSON is a valid JSON (validated here)
It was the prompts collection.
It should have been a list of strings and not of objects.
A decent error message would have been nice.
The JSON you've provided is the JSON that Dialogflow will send to your webhook in the body of the request to your webhook. To respond to your users you must respond to this request with a response that looks like this:
Headers:
Content-type: application/json
Body:
{
"speech": "Barack Hussein Obama II was the 44th and current President of the United States.",
"displayText": "Barack Hussein Obama II was the 44th and current President of the United States, and the first African American to hold the office. Born in Honolulu, Hawaii, Obama is a graduate of Columbia University and Harvard Law School, where ",
"data": {...},
"contextOut": [...],
"source": "..."
}
the data, contextOut and source attributes are optional. speech and displayText are required and correspond to what is spoken and displayed to the user respectively.

Use of ResultTemplate in vsts extension tasks

I created a task that talks to a REST API to retreive the values for 2 picklists.
Filling the first dropdown box works fine, when using just the jsonpath.
Based on the first picklist I'd like to retreive values of the second list.
I've tried some variations and I'm trying something like this:
The json which I receive in the first rest call is similar to:
{
"id": "45",
"href": "https://selfservice/api/configurations/45/",
"name": "Type",
"description": "",
"version": "0.0.4",
"attributes": [
{
"value": {
"sdk-object": {
"type": "ConfigurationElement",
"id": "56"
}
},
"type": "ConfigurationElement",
"name": "win"
},
{
"value": {
"sdk-object": {
"type": "ConfigurationElement",
"id": "57"
}
},
"type": "ConfigurationElement",
"name": "lin"
}
]
}
I try to show the attributes name in the list and need the id of the attribute in the second picklist.
I created the following datasourcebindings in the task.json. Of course, the targets exist in the task.
task.json:
{
"id": "GUID",
"name": "Spinup",
"friendlyName": "Create environment",
"description": "Starts Workflow to create an environment. ___ The following placeholders are created deplending on the template and can be used in the rest of the release:**XLDEnvironment** and **testAgentHostname**",
"category": "Deploy",
"author": "***",
"version": {
"Major": 0,
"Minor": 0,
"Patch": 33
},
"minimumAgentVersion": "1.95.3",
"inputs": [
{
"label": "Endpoint",
"name": "connectedServiceName",
"required": true,
"type": "connectedService:server",
"helpMarkDown": "endpoint to connect to."
},
{
"name": "stage",
"type": "string",
"label": "Stage",
"defaultValue": "$(Release.EnvironmentName)",
"required": true,
"helpMarkDown": "Stage of the release, default value is based on the pipeline."
},
{
"name": "releaseName",
"type": "string",
"label": "Environment name",
"defaultValue": "$(Release.ReleaseName)",
"required": true,
"helpMarkDown": "Name of the environment that will be created."
},
{
"name": "owner",
"type": "string",
"label": "Owner of the environment",
"defaultValue": "***",
"required": true,
"helpMarkDown": "It is common to use the initials of the product owner in this field. There has to be a valid AD user owner of each environment. This can also be set by using a variable through the pipeline."
},
{
"name": "group",
"type": "string",
"label": "Group of the owner",
"defaultValue": "",
"required": true,
"helpMarkDown": "group that owns the environment. groups can be requested by the infrastructure department. Example: ****"
},
{
"name": "platform",
"type": "pickList",
"label": "Platform (OS)",
"defaultValue": "",
"required": true,
"helpMarkDown": "Choose the type of the target platform."
},
{
"name": "size",
"type": "pickList",
"label": "Environment Template",
"defaultValue": "",
"required": true,
"helpMarkDown": "Size of the environment to create."
}
],
"dataSourceBindings": [
{
"dataSourceName": "GetCEPlatformType",
"endpointId": "$(connectedServiceName)",
"target": "platform",
"selector": "jsonpath:$.attributes[*].name",
"keySelector": "jsonpath:$.attributes[*].value.sdk-object.id"
},
{
"dataSourceName": "GetCEPlatformSize",
"endpointId": "$(connectedServiceName)",
"target": "size",
"parameters": {
"platformTypeId": "$(platform)"
}
}
],
"instanceNameFormat": "Spin up $(size) $(platform) environment",
"execution": {
"PowerShell3": {
"target": "$(currentDirectory)\\task.ps1",
"argumentFormat": "",
"workingDirectory": "$(currentDirectory)"
}
}
}
vss-extension.json:
{
"manifestVersion": 1,
"id": "*****",
"name": "Release Tasks",
"version": "1.0.1",
"publisher": "***",
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"description": "Tools to contact ***. Includes a task to spin up a platform and a task to remove the platform.",
"categories": [
"Build and release"
],
"icons": {
"default": "images/extension-icon.png"
},
"files": [
{
"path": "RemoveEnvironment"
},
{
"path": "SpinUpEnvironment"
}
],
"contributions": [
{
"id": "******",
"type": "ms.vss-distributed-task.task",
"targets": [
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "RemoveEnvironment"
}
},
{
"id": "*********",
"type": "ms.vss-distributed-task.task",
"targets": [
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "SpinUpEnvironment"
}
},
{
"description": "Service Endpoint type for all connections",
"id": "endpoint-type",
"properties": {
"authenticationSchemes": [
{
"inputDescriptors": [
{
"description": "Username",
"id": "username",
"inputMode": "textbox",
"name": "Username",
"validation": {
"dataType": "string",
"isRequired": true
}
},
{
"description": "Password",
"id": "password",
"inputMode": "passwordbox",
"isConfidential": true,
"name": "Password",
"validation": {
"dataType": "string",
"isRequired": false
}
}
],
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic"
}
],
"dataSources": [
{
"endpointUrl": "api/configurations/*****/",
"name": "GetCEPlatformType",
"resultSelector": "jsonpath:$.attributes[*].name"
},
{
"endpointUrl": "api/configurations/$(platformTypeId)/",
"name": "GetCEPlatformSize",
"resultSelector": "jsonpath:$.attributes[*].name"
}
],
"displayName": "*****",
"helpMarkDown": "Enter the url and credentials to connect to the endpoint.",
"name": "server",
"url": {
"displayName": "Server URL",
"helpText": "Url for the server to connect to."
}
},
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"type": "ms.vss-endpoint.service-endpoint-type"
}
]
}
Sadly I can't get this to work. The datasources exist in the endpoint, but I'm not sure what to do with the resultSelector.
Does anyone have an idea on how to get this to work? The documentation on this isn't too good.
I'm not familiar with mustache, but in the mustache test tool this seems to work.
Thoughts are appreciated!
Try with this in the first data source:
{
"dataSourceName": "dsList1",
"endpointId": "$(connectedServiceName)",
"target": "list1",
"selector": "jsonpath:$.attributes[*].name",
"keySelector": "jsonpath:$.attributes[*].value.sdk-object.id"
}
Update:
You were trying to use "platformTypeId" in vss-extension.json file while it was defined in task.json, this cause the error message you mentioned in the comment.
By the way, I just noticed that you are using "dataSourceBindings", then you cannot use "selector" and "KeySelector" to parse the result since they are used for "sourceDefinitions".
To achieve the feature you want with "dataSourceBindings", you can definition the endpoint url in the task.json directly instead of defining datasource in endpoint contribution.
So you can move the datasources section in the vss-extension.json file first, and then in the task.json file, change to following:
"dataSourceBindings": [
{
"endpointId": "$(connectedServiceName)",
"endpointURL": "api/configurations/*****/",
"target": "platform",
"resultselector": "jsonpath:$.attributes[*]",
"resultTemplate": "{ \"Value\" : \"{{{value.id}}}\", \"DisplayValue\" : \"{{{name}}}\" }"
},
{
"endpointId": "$(connectedServiceName)",
"endpointURL": "api/configurations/$(platformTypeId)/",
"target": "size"
}
],

Microsoft outlook 365 actionable message

Hi would like to know why my actionable message will not appear on mobile but on the web it will appear perfectly. Anyone know what is the problem i'm facing?
Below are the script that i'm putting.
<script type="application/ld+json">
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"summary": "This is the summary property",
"themeColor": "0075FF",
"sections": [{
"heroImage": {
"image": "http://messagecardplayground.azurewebsites.net/assets/FlowLogo.png"
}
},
{
"startGroup": true,
"title": "**Pending approval**",
"activityImage": "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
"activityTitle": "Requested by **Miguel Garcia**",
"activitySubtitle": "m.garcia#contoso.com",
"facts": [{
"name": "Date submitted:",
"value": "06/27/2017, 2:44 PM"
},
{
"name": "Details:",
"value": "Please approve the awesome changes I made to this fantastic document."
},
{
"name": "Link:",
"value": "[Link to the awesome document.pptx](http://www.google.com)"
}
]
},
{
"potentialAction": [{
"#type": "ActionCard",
"name": "Approve",
"inputs": [{
"#type": "TextInput",
"id": "comment",
"isMultiline": true,
"title": "Reason (optional)"
}],
"actions": [{
"#type": "HttpPOST",
"name": "Submit",
"target": "http://..."
}]
},
{
"#type": "ActionCard",
"name": "Reject",
"inputs": [{
"#type": "TextInput",
"id": "comment",
"isMultiline": true,
"title": "Reason (optional)"
}],
"actions": [{
"#type": "HttpPOST",
"name": "Submit",
"target": "http://..."
}]
}
]
},
{
"startGroup": true,
"activitySubtitle": "Grant approvals directly from your mobile device with the Microsoft Flow app. [Learn more](http://learnmode)\n\nThis message was created by an automated workflow in Microsoft Flow. Do not reply."
}
]
}
</script>
If i open my Outlook mobile app, There will be no card shown, but only on outlook web. Does actionable message does not support mobile currently?
Regards,
Khairul Ezwan B. Mohd Kaswan

How can I sort facebook feeds by "caption"?

I have this JSON data from my facebook page:
{
"data": [
{
"id": "1234567890_0987654321",
"from": {
"name": "My Facebook Page",
"category": "Personal blog",
"id": "1234567890"
},
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Like",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Action Name",
"link": "http://example.com/"
}
],
"message": "This post discusses something about Javascript.",
"name": "A post about javascript.",
"link": "http://example.com/",
"caption": "JavaScript",
"description": "Something telling about the post.",
"created_time": "2012-10-09T03:35:22+0000"
},
{
"id": "1234567890_0987654321",
"from": {
"name": "My Facebook Page",
"category": "Personal blog",
"id": "1234567890"
},
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Like",
"link": "http://www.facebook.com/1234567890/posts/0987654321"
},
{
"name": "Action Name",
"link": "http://example.com/"
}
],
"message": "This post discusses something about CSS.",
"name": "A post about CSS.",
"link": "http://example.com/",
"caption": "CSS",
"description": "Something telling about the post.",
"created_time": "2012-10-09T03:35:22+0000"
}
]
}
Is there anyway I can do this with FQL where I will just have all the posts with "caption": "JavaScript"? I want to sort my post by category and my keywords are inside the "caption" attribute.
IF you want to get feeds short by order you need to use FQL
here is sample one of them
SELECT post_id, actor_id, target_id,description, message FROM stream WHERE source_id = me() order by description
Thank you to all who responded my question. I think I got the answer to my question already.
I will just do this query on FQL to get all posts with "caption": "Javascript":
SELECT actor_id,message,attachment FROM stream WHERE source_id=1234567890 AND attachment.caption="Javascript"