How to capture action of hyperlinks of adaptive card in c# - c#

I want to capture of action performed on hyperlink on Microsoft bot adaptive card. Using selection action I can capture the action but it's applicable for whole sentence. However, I want it to capture if it's clicked on link only. Below is my JSON template.
{
"type": "AdaptiveCard",
"body": [{
"type": "Container",
"items": [{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Test header",
"wrap": true
}],
"width": "stretch"
}]
},
{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"weight": "Bolder",
"text": "- first test [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",
"wrap": true
}],
"width": "stretch",
"selectAction": {
"type": "Action.OpenUrl",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
}]
},
{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"weight": "Bolder",
"text": "- second test [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",
"wrap": true
}],
"width": "stretch"
}]
},
{
"type": "ColumnSet",
"columns": [{
"type": "Column",
"items": [{
"type": "TextBlock",
"weight": "Bolder",
"text": "- third test [link](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",
"wrap": true
}],
"width": "stretch"
}]
}
]
}],
"backgroundImage": {
"url": "#",
"fillMode": "RepeatVertically"
},
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"id": "test"
}
Can you please guide me how can I achieve it?

Related

Multi-tab in message extension like shown in the microsoft documentation

How can I add multiple tab in message extension in Bot Framework using C# like as shown in this image here ?
enter image description here
You can add it by adding multiple search commands in the manifest file. Sharing part of JSON below.
"composeExtensions": [
{
"botId": "448ec85c-4395-4f80-b5a1-cd3bdefd1f5b",
"canUpdateConfiguration": true,
"commands": [
{
"id": "searchQuery",
"context": [
"compose",
"commandBox"
],
"description": "Test command to run query",
"title": "Search",
"type": "query",
"initialRun": true,
"parameters": [
{
"name": "searchQuery",
"title": "Search Query",
"description": "Your search query",
"inputType": "text"
}
]
},
{
"id": "searchQuery2",
"context": [
"compose",
"commandBox"
],
"description": "Test command to run query2",
"title": "Search2",
"type": "query",
"initialRun": true,
"parameters": [
{
"name": "searchQuery2",
"title": "Search Query2",
"description": "Your search query2",
"inputType": "text"
}
]
},
{
"id": "searchQuery3",
"context": [
"compose",
"commandBox"
],
"description": "Test command to run query",
"title": "Search3",
"type": "query",
"initialRun": true,
"parameters": [
{
"name": "searchQuery3",
"title": "Search Query3",
"description": "Your search query3",
"inputType": "text"
}
]
}
]
Here is the sample - https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/50.teams-messaging-extensions-search

Adaptive Card horizontal alignment property to "Center" or "Right" is not working in MS Teams on iOS mobile app

We have an issue with "Horizontal alignment" property in the following adaptive elements: AdaptiveColumn, AdaptiveTextBlock and AdaptiveImage. Setting this property to "Center" or "Right" causing major design issues(see the attached images).
Original:
"Right" alignment:
Here is the JSON:
{
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": 15,
"items": []
},
{
"type": "Column",
"width": 15,
"items": [
{
"type": "Image",
"url": "https://cdn4.iconfinder.com/data/icons/arrows-9/100/arrow-9-512.png",
"width": "30px",
"height": "24px"
}
],
"verticalContentAlignment": "Center",
"selectAction": {
"type": "Action.Submit",
"title": "Previous"
},
"horizontalAlignment": "Left"
},
{
"type": "Column",
"width": 40,
"items": [
{
"type": "Image",
"size": "Large",
"url": "https://aboutflowers.com/wp-content/uploads/2016/10/AboutFlowers_S600Alstroemera_SymphonyMorita_Esmeralda.jpg",
"horizontalAlignment": "Center"
}
]
},
{
"type": "Column",
"width": 15,
"items": [
{
"type": "Image",
"url": "https://cdn4.iconfinder.com/data/icons/arrows-9/100/arrow-10-512.png",
"width": "30px",
"horizontalAlignment": "Right",
"height": "24px"
}
],
"verticalContentAlignment": "Center",
"selectAction": {
"type": "Action.Submit",
"title": "Next"
}
},
{
"type": "Column",
"width": 15,
"items": []
}
]
}
]
},
{
"type": "TextBlock",
"text": "Image1",
"horizontalAlignment": "Center"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
The same design works properly on Android and Desktop client.
Stack Overflow is not for bug reports. You can submit feedback through the Teams app itself or you can have a look at this feedback page: https://learn.microsoft.com/en-us/microsoftteams/platform/feedback
If you do submit feedback, feel free to link to this Stack Overflow post in order to provide the necessary information.
Until the bug is fixed, you will need to find some kind of workaround. Perhaps you can try the "center" alignment instead of left and right. If that doesn't work then you may have to not use any alignment. You may be interested to know that the schema mentions the possibility of image distortion when using the height property, so you might also try omitting width and height specifications: https://adaptivecards.io/explorer/Image.html

Automatically Bot display rating card after few seconds to take user feedback

I have a bot made using framework v4 in c#. I want that my bot take user feedback once the bot goes idle, or in the case user doesn't responded to bot.I have made my card but not getting any logic to implement above mention feature in my bot. I am also attaching the code of card i made. Also the image of my card.
Can any look into it and help me out with this implementation.
enter image description here
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"color": "Accent",
"text": "Rate your experience!"
},
{
"type": "TextBlock",
"separator": true,
"text": "Please rate your experience! Your feedback is very appreciated and will help improve your experience in the future. ",
"wrap": true
},
{
"type": "ColumnSet",
"spacing": "Medium",
"columns": [
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "awful"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Awful"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "bad"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Bad"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "normal"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "normal"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "good"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Good"
}
],
"width": "stretch"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "terrific"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Terrific"
}
],
"width": "stretch"
}
]
},
{
"type": "Input.Text",
"id": "comment",
"placeholder": "Add a comment",
"isMultiline": true
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"actions":
[
{
"type": "Action.Submit",
"title": "OK",
// "data": "ok"
}
]}
There isn't a built-in way to do this, nor is there a "standard" suggestion. However, we typically recommend:
On each message, start an asynchronous timer. You can do this in the bot, but it would be better to do outside of the bot, like with Azure Functions or something. The rest of this answer will assume the timer is outside of the bot. Ensure the timer also keeps track of the conversationReference related to the timer.
Restart the timer each time the user matching that conversationReference sends a message
Once the timer expires, send an event to the bot with the user and conversation information (maybe through ChannelData), letting the bot know the timer has expired. You could also create a separate endpoint and monitor there, so you don't need the activity scheme; instead of /api/messages, you could use something like /api/expiredTimers.
Once the expired timer event is received, send a proactive message to the user to either 1) see if they're still there, or 2) end the conversation.
You could utilize the code that ShowTypingMiddleware uses. Upon receiving a message activity, it then sets a timer, when the timer is triggered, execute your pro-active activity.
I just implemented this for a "are you still there?" functionality. Pretty straightforward.
Just have to modify the SendTypingAsync to execute whatever activity you want to send to the user at that time.

Send email report after test execution in Azure pipelin

I have implemented C# selenium automation script with Azure pipeline. I wanted to send the execution test result to my email id. Is there any way we can achieve this?
For now , you can only write a custom extension to send an email with the test result which you can call it from your Azure devops pipeline.
But you can use below set of API for getting the test result.
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=5.0
with optional parameter.
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?detailsToInclude={detailsToInclude}&$skip={$skip}&$top={$top}&outcomes={outcomes}&api-version=5.0
where params are :
here is the sample response:
{
"count": 3,
"value": [
{
"id": 100000,
"project": {
"id": "5c3d39df-a0cb-49da-be01-42e53792c0e1",
"name": "Fabrikam-Fiber-TFVC",
"url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
},
"startedDate": "2016-07-13T11:12:48.487Z",
"completedDate": "2016-07-13T11:12:48.493Z",
"durationInMs": 4,
"outcome": "Passed",
"revision": 1,
"runBy": {
"id": "a5cbf24d-799f-452e-82be-f049a85b5895",
"displayName": "Fabrikam",
"uniqueName": "fabrikamfiber.vsin#hotmail.com",
"url": "https://dev.azure.com/fabrikam/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
},
"state": "Completed",
"testCase": {
"name": "Pass1"
},
"testRun": {
"id": "16",
"name": "VSTest Test Run release any cpu",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16"
},
"lastUpdatedDate": "2016-07-13T11:12:49.123Z",
"lastUpdatedBy": {
"id": "375baa5b-5148-4e89-a549-ec202b722d89",
"displayName": "Project Collection Build Service (fabrikam)",
"uniqueName": "Build\\78b5727d-4a24-4ec8-9caf-704685572174",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/375baa5b-5148-4e89-a549-ec202b722d89",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=375baa5b-5148-4e89-a549-ec202b722d89"
},
"priority": 0,
"computerName": "TASKAGENT5-0055",
"build": {
"id": "5",
"name": "20160713.2",
"url": "https://dev.azure.com/fabrikam/_apis/build/Builds/5"
},
"createdDate": "2016-07-13T11:12:49.123Z",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/Results/100000",
"failureType": "None",
"automatedTestStorage": "unittestproject1.dll",
"automatedTestType": "UnitTest",
"automatedTestTypeId": "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b",
"automatedTestId": "aefba017-ab06-be36-6b92-de4e29836f72",
"area": {
"id": "37528",
"name": "Fabrikam-Fiber-TFVC",
"url": "vstfs:///Classification/Node/ebe8ac79-8d9f-4a5b-8d0a-c3095c81e70e"
},
"testCaseTitle": "Pass1",
"customFields": [],
"automatedTestName": "UnitTestProject1.UnitTest1.Pass1"
},
{
"id": 100001,
"project": {
"id": "5c3d39df-a0cb-49da-be01-42e53792c0e1",
"name": "Fabrikam-Fiber-TFVC",
"url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
},
"startedDate": "2016-07-13T11:12:48.547Z",
"completedDate": "2016-07-13T11:12:48.62Z",
"durationInMs": 74,
"outcome": "Failed",
"revision": 1,
"runBy": {
"id": "a5cbf24d-799f-452e-82be-f049a85b5895",
"displayName": "Fabrikam-Fiber-TFVC",
"uniqueName": "fabrikamfiber.vsin#hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
},
"state": "Completed",
"testCase": {
"name": "Fail1"
},
"testRun": {
"id": "16",
"name": "VSTest Test Run release any cpu",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16"
},
"lastUpdatedDate": "2016-07-13T11:12:49.123Z",
"lastUpdatedBy": {
"id": "375baa5b-5148-4e89-a549-ec202b722d89",
"displayName": "Project Collection Build Service (fabrikam)",
"uniqueName": "Build\\78b5727d-4a24-4ec8-9caf-704685572174",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/375baa5b-5148-4e89-a549-ec202b722d89",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=375baa5b-5148-4e89-a549-ec202b722d89"
},
"priority": 10,
"computerName": "TASKAGENT5-0055",
"build": {
"id": "5",
"name": "20160713.2",
"url": "https://dev.azure.com/fabrikam/_apis/build/Builds/5"
},
"errorMessage": "Assert.Fail failed. ",
"createdDate": "2016-07-13T11:12:49.123Z",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/Results/100001",
"failureType": "None",
"automatedTestStorage": "unittestproject1.dll",
"automatedTestType": "UnitTest",
"automatedTestTypeId": "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b",
"automatedTestId": "7c66fbda-2d0e-a714-e18d-83c0464019a5",
"area": {
"id": "37528",
"name": "Fabrikam-Fiber-TFVC",
"url": "vstfs:///Classification/Node/ebe8ac79-8d9f-4a5b-8d0a-c3095c81e70e"
},
"testCaseTitle": "Fail1",
"stackTrace": " at UnitTestProject1.UnitTest1.Fail1() in C:\\a\\1\\s\\UnitTestProject1\\UnitTestProject1\\UnitTest1.cs:line 20\r\n",
"customFields": [],
"failingSince": {
"date": "2016-07-13T11:11:17.587Z",
"build": {
"id": 4,
"definitionId": 0,
"number": "20160713.1",
"buildSystem": "Azure DevOps Services"
}
},
"automatedTestName": "UnitTestProject1.UnitTest1.Fail1"
},
{
"id": 100002,
"project": {
"id": "5c3d39df-a0cb-49da-be01-42e53792c0e1",
"name": "Fabrikam-Fiber-TFVC",
"url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
},
"startedDate": "2016-07-13T11:12:48.623Z",
"completedDate": "2016-07-13T11:12:48.623Z",
"outcome": "NotExecuted",
"revision": 1,
"runBy": {
"id": "a5cbf24d-799f-452e-82be-f049a85b5895",
"displayName": "Fabrikam-Fiber-TFVC",
"uniqueName": "fabrikamfiber.vsin#hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
},
"state": "Completed",
"testCase": {
"name": "Ignore1"
},
"testRun": {
"id": "16",
"name": "VSTest Test Run release any cpu",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16"
},
"lastUpdatedDate": "2016-07-13T11:12:49.123Z",
"lastUpdatedBy": {
"id": "375baa5b-5148-4e89-a549-ec202b722d89",
"displayName": "Project Collection Build Service (fabrikam)",
"uniqueName": "Build\\78b5727d-4a24-4ec8-9caf-704685572174",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/375baa5b-5148-4e89-a549-ec202b722d89",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=375baa5b-5148-4e89-a549-ec202b722d89"
},
"priority": 20,
"computerName": "TASKAGENT5-0055",
"build": {
"id": "5",
"name": "20160713.2",
"url": "https://dev.azure.com/fabrikam/_apis/build/Builds/5"
},
"createdDate": "2016-07-13T11:12:49.123Z",
"url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/Results/100002",
"failureType": "None",
"automatedTestStorage": "unittestproject1.dll",
"automatedTestType": "UnitTest",
"automatedTestTypeId": "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b",
"automatedTestId": "ef9123e0-a097-7e9b-9a02-f526c7a640c0",
"area": {
"id": "37528",
"name": "Fabrikam-Fiber-TFVC",
"url": "vstfs:///Classification/Node/ebe8ac79-8d9f-4a5b-8d0a-c3095c81e70e"
},
"testCaseTitle": "Ignore1",
"customFields": [],
"automatedTestName": "UnitTestProject1.UnitTest1.Ignore1"
}
]
}
You can write a custom utility in which you can write a function to get the test result and publish it using email and then later on you can call it from Azure devops pipeline task.
Here you can find the sample doc for custom defined task.
Hope it helps.

Create DropDown list for jira custom field in REST API

I'm trying to retrieve the available options for fields through the Jira REST API but I'm getting stuck on the custom fields.
A normal field returns something like this:
{[priority, {
"required": false,
"schema": {
"type": "priority",
"system": "priority"
},
"name": "Priority",
"key": "priority",
"hasDefaultValue": true,
"operations": [
"set"
],
"allowedValues": [
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/1",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/highest.svg",
"name": "Highest",
"id": "1"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/2",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/high.svg",
"name": "High",
"id": "2"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/3",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/4",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/low.svg",
"name": "Low",
"id": "4"
},
{
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/5",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/lowest.svg",
"name": "Lowest",
"id": "5"
}
],
"defaultValue": {
"self": "https://inn-inw.atlassian.net/rest/api/2/priority/3",
"iconUrl": "https://inn-inw.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
}
}]}
The custom fields on the other hand return a much "smaller" set!
"Sprint" Custom Field:
{[customfield_10113, {
"required": false,
"schema": {
"type": "array",
"items": "string",
"custom": "com.pyxis.greenhopper.jira:gh-sprint",
"customId": 10113
},
"name": "Sprint",
"key": "customfield_10113",
"hasDefaultValue": false,
"operations": [
"set"
]
}]}
"Epic Link"
{[customfield_10006, {
"required": false,
"schema": {
"type": "any",
"custom": "com.pyxis.greenhopper.jira:gh-epic-link",
"customId": 10006
},
"name": "Epic Link",
"key": "customfield_10006",
"hasDefaultValue": false,
"operations": [
"set"
]
}]}
As you can see there are no options available, but i know that there are.
How can I get to these values through rest?
I have tried checking the request that the cloud server makes but it's pretty different for each of the custom fields and i cannot find a relation between them. For example:
To get the sprint possible values: https://inn-inw.atlassian.net/rest/greenhopper/1.0/sprint/picker?query=
and to get the Epic values: https://inn-inw.atlassian.net/rest/greenhopper/1.0/epics
I'm trying to make things as clean as possible and I would prefer not to hard code the request, specially because i would probably need to update the code every time a new custom field is created.
PS: I have tried some of the solutions presented in other questions but couldn't find one that fits what i need. eg: https://inn-inw.atlassian.net//rest/api/2/issue/createmeta?projectKeys=PROJKEY&issuetypeNames=Bug&expand=projects.issuetypes.fields returns only the short description that is displayed above.

Categories

Resources