Hi folks,
MS has seen fit to deprecate their connectors in favor of transitioning to PowerAutomate Workflows. The workflow, as I understand it, essentially functions the same as a webhook (i.e., You get a webhook POST endpoint and any payload it receives it will post to a MS Teams channel):
But that doesn't seem to work as advertised:
Which I'm seeing fail out with the following:
```
The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']' is of type 'Null'. The result must be a valid array.
```
From what I can tell, it seems like JSON body being sent over doesn't contain any attachments? Has anyone else made this move to Workflows? If so, how did you do it?
Hi - I have gotten this to work directly in Jira Automation by
Adding the Flow Bot to the Channel in Teams as per below
Using the "Send Web Request"
Inputting the new webhook url (post type) - and using the below custom data body
{
"type": "Application/JSON",
"attachments": [{
"contentType": "object",
"content": {
"type": "AdaptiveCard",
"version": "1.4",
"body": [{
"type": "TextBlock",
"text": "{{issue.summary}}",
"isSubtle": false,
"wrap": false,
"size": "Large",
"weight": "Bolder",
"spacing": "None"
}, {
"type": "TextBlock",
"text": "{{issue.key}}",
"isSubtle": false,
"wrap": false,
"spacing": "None"
}, {
"type": "TextBlock",
"text": "Created by: {{issue.reporter.displayName}}",
"isSubtle": false,
"wrap": false,
"spacing": "None"
}, {
"type": "TextBlock",
"text": "Status: {{issue.Request Type.currentStatus.status}}",
"isSubtle": false,
"wrap": false,
"spacing": "None"
}
]
}
}
]
}
Its pretty basic but the unmodified workflow works successfully now
Thanks Ryan for pointing me in the right direction with your code
I will see if Atlassian updates their code for the standard teams automation in the coming weeks before switching over to the above
I was able to make it work with a "basic" jason just like you. I appreciate the idea you brought up because i was able to implement it. if anyone needs a copy of my {{issueslookup}} push to an incoming webhook I will be happy to provide it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you help me with solving this issue? i am still stuck with
'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']' is of type 'Null'. The result must be a valid array.
this error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, of course. You have to select as shown in this picture. If you nee help on the JSON just provide me the tags/smart values you need to push and I'll be happy to help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Thanks Jesus
below JSON i am using in this jira automation
:
{
"text": "Unassigned tickets (Number of tickets : {{lookupIssues.size}})\n{{#lookupIssues}}\nKey: [{{key}}]({{url}})\nSummary: {{summary}}\nPriority: {{priority.name}}\nReporter: {{fields.reporter.displayName}}\n{{/lookupIssues}}\n"
}
which searches for number of unassigned tickets and the list of those tickets in single teams message.
Thanks Jesus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For any of the fields you're including in the web request that can contain data you don't control (ie: the {{issue.summary}}, {{issue.description}}), you will want to add the .jsonEncode function to them, otherwise any user data which contains characters like quotes will break the json encoding and your web request will fail. Use:
{{issue.summary.jsonEncode}}
{{issue.description.jsonEncode}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is the code, after you copy/paste please make sure you have in the "Send Web Request" the correct headers.
******************************
{
"type": "Application/JSON",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "🔔**Unassigned JIRA Tickets**",
"wrap": true,
"weight": "Bolder",
"size": "Large",
"color": "Accent"
},
{
"type": "TextBlock",
"text": "Here is a summary of unassigned JIRA tickets.",
"wrap": true,
"spacing": "None"
},
{
"type": "TextBlock",
"text": "Number of tickets: {{lookupIssues.size}}",
"wrap": true,
"weight": "Bolder",
"size": "Medium",
"color": "Good"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Key",
"weight": "Bolder",
"color": "Light",
"wrap": true,
"size": "Medium"
}
],
"backgroundColor": "DarkBlue"
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Summary",
"weight": "Bolder",
"color": "Light",
"wrap": true,
"size": "Medium"
}
],
"backgroundColor": "DarkBlue"
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Reporter",
"weight": "Bolder",
"color": "Light",
"wrap": true,
"size": "Medium"
}
],
"backgroundColor": "DarkBlue"
}
]
},
{
"type": "Container",
"spacing": "Medium",
"separator": true,
"items": [
{
"type": "TextBlock",
"text": "{{#lookupIssues}}",
"wrap": false
},
{
"type": "ColumnSet",
"spacing": "Medium",
"separator": true,
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "[{{key}}]({{url}})",
"wrap": true,
"color": "Accent",
"weight": "Bolder",
"size": "Default"
}
],
"backgroundColor": "#F3F3F3",
"separator": true
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "{{summary.jsonEncode}}",
"wrap": true,
"size": "Default"
}
],
"backgroundColor": "#F3F3F3",
"separator": true
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "{{fields.reporter.displayName.jsonEncode}}",
"wrap": true,
"size": "Default"
}
],
"backgroundColor": "#F3F3F3",
"separator": true
}
]
},
{
"type": "TextBlock",
"text": "{{/lookupIssues}}",
"wrap": false
}
]
},
{
"type": "TextBlock",
"text": "💡 For more details, please visit the JIRA dashboard",
"wrap": true,
"size": "Small",
"weight": "Lighter",
"color": "Attention"
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "View in JIRA portal",
"url": "Your own URL"
}
]
}
}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jesus Cordoba
I was just trying out posting a very basic message which I've used the connector for in the past. I've tried adapting it like you mentioned above but I'm not getting the results I expect.
What I want to post is this (body of the message I use for the connectors):
*{{reporter.displayName}}* has raised [{{issue.key}} {{issue.summary}}] ({{issue.toUrl}})
Could you help me in how to manage this via the webhook directly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Of course @Peter Martens - here is your code, do you need help with building the flow?
****************************************************************
{
"type": "Application/JSON",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "Unassigned tickets (Number of tickets: {{lookupIssues.size}})",
"wrap": true,
"weight": "Bolder",
"size": "Large",
"color": "Accent"
},
{
"type": "TextBlock",
"text": "{{#lookupIssues}}",
"wrap": true
},
{
"type": "TextBlock",
"text": "*{{fields.reporter.displayName.jsonEncode}}* has raised [{{key}} {{summary.jsonEncode}}]({{url}})",
"wrap": true
},
{
"type": "TextBlock",
"text": "{{/lookupIssues}}",
"wrap": true
}
]
}
}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for the JSON template! It works for the most part during my testing, however, it does fail to trigger a notification for tickets with attachments inside them.
The error message in Jira's audit log reads: code":"InvalidRequestContent","message":"The request content is not valid and could not be deserialized: 'Bad JSON escape sequence
Is anyone else getting this?
EDIT: Actually, it's not just tickets with attachments in them... I'm not sure why it gives that error for some tickets but not others.
EDIT2: Fixed my problem by using .jsonencode
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jesus Cordoba ,
Thanks for the JSON, Unfortunately it seems I'm still missing some key points because it comes out like this in the teams channel:
If anyone knows what I'm missing please let me know, I also see some new information in this thread so I'll also read some more to see if that provides me with the answer I'm looking for.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I found out I used the wrong process step. I was using post message instead of post card.
Now I've updated this and now I'm getting a card, unfortunately this is empty:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all, I've tried some more things without success. Dummy messages are okay but when I use the JSON above I get this message:
BadRequest. The request failed. Error code: 'InvalidBotAdaptiveCard'. Error Message: 'Microsoft.Azure.ProcessSimple.Data.Entities.Exceptions.ProcessSimpleDataException: The specified Teams flowbot adaptive card request is missing or invalid. The tracking Id is '{0}'. ---> AdaptiveCards.AdaptiveSerializationException: Property 'type' must be 'AdaptiveCard' at AdaptiveCards.AdaptiveCardConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at AdaptiveCards.AdaptiveCard.FromJson(String json) at Microsoft.Azure.ProcessSimple.Data.Components.AdaptiveCards.AdaptiveCardBuilder.DeserializeAdaptiveCard(String serializedAdaptiveCard, RequestIdentity requestor, CultureInfo cultureInfo, BotAdaptiveCardAtMentions atMentions) in C:\__w\1\s\src\processsimple\Roles\ProcessSimple.Data\Components\AdaptiveCards\AdaptiveCardBuilder.cs:line 750 --- End of inner exception stack trace --- at Microsoft.Azure.ProcessSimple.Data.Components.AdaptiveCards.AdaptiveCardBuilder.DeserializeAdaptiveCard(String serializedAdaptiveCard, RequestIdentity requestor, CultureInfo cultureInfo, BotAdaptiveCardAtMentions atMentions) in C:\__w\1\s\src\processsimple\Roles\ProcessSimple.Data\Components\AdaptiveCards\AdaptiveCardBuilder.cs:line 754 at Microsoft.Azure.ProcessSimple.Web.Common.Validation.BotAdaptiveCard(String card, RequestIdentity senderRequestIdentity) in C:\__w\1\s\src\processsimple\Roles\ProcessSimple.Data\Common\Validation\BotValidation.cs:line 918'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi everyone,
I've finally found a solution which is working for me, maybe it might also be helpfull for someone else here.
First I created the web request from Jira:
Then in teams I created these steps:
For the message I simply added Dynamic content and chose content here:
That's it, after these steps I only faced the issue with a bot not in conversation roster error. This was caused because I was sending to a private channel. Once I was sending to an open channel this was not longer occuring.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've essentially done the same as above but get the following error:
ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['attachments']' is of type 'Null'. The result must be a valid array.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So after posting my last message I got it to work. I had incorrect message type. One outstanding question though, I used adaptive card waiting on response, I will test but will just posting a card work the same way?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jesus Cordoba thanks for the template ... works like a charm
I do hope Microsoft's documentation included these changes to the card schema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey all, so thanks to everyone for the contributions. I ended up with something similar to what many of you have posted:
{
"type": "Application/JSON",
"attachments": [
{
"contentType": "object",
"content": {
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "⚠️ A new ticket has been assigned to the Network Team",
"isSubtle": false,
"wrap": true,
"weight": "Bolder",
"spacing": "None",
"color":"Attention" },
{
"type": "TextBlock",
"text": "A new ticket has been received. Please ensure you triage and assign the ticket accordingly.",
"isSubtle": false,
"wrap": true,
"weight": "Lighter",
"spacing": "None",
"color":"default"
},
{
"type": "TextBlock",
"text": "**Summary:** {{issue.summary}}",
"isSubtle": false,
"wrap": true,
"spacing": "None"
},
{
"type": "TextBlock",
"text": "**Description:** {{issue.description.jsonencode}}",
"isSubtle": false,
"wrap": true,
"spacing": "None"
},
{
"type": "TextBlock",
"text": "**Issue key:** {{issue.key}}",
"isSubtle": false,
"wrap": false,
"spacing": "None"
},
{
"type": "TextBlock",
"text": "**Created by:** {{issue.reporter.displayName}}",
"isSubtle": false,
"wrap": false,
"spacing": "None"
},
{
"type": "TextBlock",
"text": "**Status:** {{issue.Request Type.currentStatus.status}}",
"isSubtle": false,
"wrap": false,
"spacing": "None"
},
{
"type": "TextBlock",
"text": "💡 For more details, click the **Open Issue** button below",
"wrap": true,
"size": "Small",
"weight": "Lighter",
"color": "Attention"
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "Open Issue",
"url": "{{issue.url}}"
}
]
}
}
]
}
I think some of the key bits for me were the `.jsonencode` function (that saved my 🥓 @Michael Orr TY!!!) and then using the adaptive card actions to open the ticket from Teams.
Practically, it comes out looking like this:
Which I'm generally happy with. It seems like there's plenty to play with according to the schema: https://adaptivecards.io/explorer/AdaptiveCard.html. Thanks again, all!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there,
(I am cross posting this suggestion, as there are quite a few users struggling with the deprecation of O365 connectors)
I work at yasoon, an Atlassian Marketplace Platinum Partner. Our focus is to provide applications that deeply integrate Jira and Microsoft 365. So this topic is part of our everyday life and that's why I felt called to share this video with you:
In the video we’re showing you how to set up basic and advanced automations with Microsoft and Jira. Hope it helps.
Jira automation: How to deal with the retirement o... - Atlassian Community
Happy Friday!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Eric Sebian , the app is also available for DC: Microsoft 365 for Jira - Outlook Email, Teams, Calendar | Atlassian Marketplace
If you need help setting up anything, you can get in touch with us here: yasoon Support - Jira Service Management (atlassian.net)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Britta.
this doesn't work for DC the way that it is noted for cloud. DC doesn't have the Actions option yet. the image from cloud shows that that option is needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eric, that's right. In DC you can only work with triggers. Can you schedule a call with support so we can advise you on your use case? yasoon Support - Jira Service Management (atlassian.net)
Best, Britta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Eric Sebian ,
I was searching for an answer too. and I saw this page... https://confluence.atlassian.com/msteamsjiraserver/jira-notifications-via-teams-workflows-1425670660.html
Maybe it can help you.
BR,
Romain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I put in a bug ticket yesterday - this is the response I got
As of now, our engineering team is evaluating the level of impact for Jira Automation from the removal of the Office 365 connectors for MS Teams. I'll let you know as soon as we have a clear response for the next step moving forward as the component that the Automation rule is using to send the message to MS team is the deprecated one, and it would need to use the new one from the backend.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian created the ticket below. Doesn't sound like a quick fix is expected.
[AUTO-1374] Provide support for Microsoft Workflows in automation rules
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have one question can we add report as an attachment in it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guys,
There is another simple way to get notified from Jira, Confluence and Bitbucket in Microsoft Teams channel using Microsoft Teams Workflows app.
Cheers,
Leo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you share? I wasn't seeing anything other than using a generic webhook endpoint to send a notification to a la https://community.atlassian.com/t5/Jira-Service-Management/Re-Transition-to-MS-Teams-Workflows/qaq-p/2757518/comment-id/175799#M175799
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Leo's suggestion does not work for me for Bitbucket.
The tooltip for the MS Teams Connector within our Bitbucket instance, explicitly states
"MS Teams webhook URL. URL must have the following pattern: https://.../IncomingWebhook/.." and the new URL does not have that pattern.
Testing the connection with the new URL yields an 'Error: Webhook URL is invalid' as you might expect.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To close out my statement, shortly after I posted this I found that the the Bitbucket MS Teams Connector had a recent update that handles the Workflows changes.
We updated the plugin in our Bitbucket instance and all is well with the new functionality - including backwards compatibility for the old /IncomingWebhook/ URL pattern.
Hope this may help someone else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We currently have a Jira automation rule which POSTs to an O365 connector and the Web Request Body (on the rule action) is "Issue Data (Jira format)"
I don't suppose anyone has already come up with the custom payload to use to replicate the same message effect with Workflows ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Adam Brunt see my reply here: https://community.atlassian.com/t5/Jira-Service-Management/Re-Transition-to-MS-Teams-Workflows/qaq-p/2757518/comment-id/175799#M175799. I took some inspiration from other folks. The kicker is that you have to have Jira post a web request. The Jira automation side looks something like this:
And then your teams workflow will use this template:
So you'll sub the webhook endpoint you get from the workflow into your Jira automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Getting the same issue. Doing a google search, a lot of people are getting the error with other apps using webhooks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had to convert my payload to a JSON string:
ConvertTo-Json
with-Depth 10
The above change got the script to post to Teams without error -with one caveat. Every post read, "Teams cannot display this message". 🤣
Modifying adaptive card version from 1.5 to 1.4 fixed that issue. Some formatting still isn't working (e.g., emojis: 🔴🟡🟢).
Another work-around is to set the flow up to post a message (i.e., not an adaptive card). That method didn't work well with JSON format (HTML did work though). Wasted half a day on this nonsense. Now I have to update all my scripts 🤬.
Here's an example that should work:
# Force TLS 1.2 for the Invoke-RestMethod command
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Define your Teams webhook URL
$TeamsWebhookUrl = "https://xxxx.xxxxxx.xxxxx"
# Function to send an alert to Teams
function Send-TeamsAlert {
param (
[string]$Title,
[string]$Description,
[string]$Date,
[string]$ArticleId,
[string]$Link
)
$adaptiveCard = @{
"\$schema" = "http://adaptivecards.io/schemas/adaptive-card.json"
"type" = "AdaptiveCard"
"version" = "1.4"
"body" = @(
@{
"type" = "Image"
"url" = "https://xxxx.xxxxxx.xxxxx/xxxx.jpg"
},
@{
"type" = "TextBlock"
"text" = "Security Advisory:"
"size" = "Large"
"wrap" = $true
"style" = "heading"
},
@{
"type" = "TextBlock"
"text" = "Article Id: $ArticleId"
"wrap" = $true
"size" = "Medium"
"weight" = "Default"
},
@{
"type" = "TextBlock"
"text" = $Title
"wrap" = $true
"spacing" = "Small"
"size" = "Medium"
},
@{
"type" = "TextBlock"
"text" = $Link
"wrap" = $true
}
)
}
$Payload = @{
"type" = "message"
"attachments" = @(
@{
"contentType" = "application/vnd.microsoft.card.adaptive"
"content" = $adaptiveCard
}
)
}
$PayloadJson = $Payload | ConvertTo-Json -Depth 10
# Send the adaptive card to Teams
Invoke-RestMethod -Uri $TeamsWebhookUrl -Method Post -ContentType "application/json" -Body $PayloadJson
}
# Function to test the alert
function Test-TeamsAlert {
Send-TeamsAlert -Title "Test Security Advisory" -Description "This is a test." -Date (Get-Date).ToString("yyyy-MM-ddTHH:mm:ssZ") -ArticleId "TEST12345" -Link "https://supportportal.juniper.net/s/global-search/%40uri?language=en_US#sort=relevancy&f:ctype=[Security%20Advisories]"
}
# Uncomment below to run test
Test-TeamsAlert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wow! Thanks y'all for the amazing feedback and responses. I've not had a chance to go through it all yet, but it looks like @Jesus Cordoba 's answer is my first port of call. I'll let y'all know how it goes!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes @Jesus Cordoba
Thank you for the JSON. It worked for me, although I had to make a few changes. Thanks for showing the correct way. One thing I'm curious about is the "Post as" title. Why are we unable to alter or edit it? Is there any way or workaround to change it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same question with regards to Post as, it is posting as myself. Can that be changed to the reporter of the Jira issue or just as a bot?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.