-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retirement of Office 365 connectors within Microsoft Teams #355
Comments
A fix for the problem will be available in time? |
This plugin can continue to be used if you translate the data it sends on power automate into Microsofts "adaptive card" format. See the comment from Damian E here: https://gitlab.com/gitlab-org/gitlab/-/issues/471344 for the template I used that got this working for me. The biggest issue I ran into is that this plugin looks for a 200 response and Power Automate does not give 200 responses, it gives 202 responses. I opened an issue to address this here: #356 |
Folks, don't get me wrong, I know it's for free and open source. But please try to see it from the Admin side, who's just a user from this point of view. It's not the aim of the user to translate anything from this plugin into whatever. Especially if the webservice isn't giving the expected response code anyway. Adjustments have to be made anyway. I think the aim should be to have one checkbox in plugin configuration to trigger the usage of another data format and expecting another response code. |
@PrismaComputer What you proposed would be nice, but the very simple addition of a 202 response code can be easily done in the short time window that Microsoft has given. Long term I wholeheartedly agree but, to be completely honest, right now I just need something that holds my team over until that long term solution is finished. |
Can be used but you need to user Power Automate and implement the workflow which will consume requests from this plugin. Is that correct? |
@damianszczepanik yes, that is correct. Its not probably the nicest solution ever but it gets the job done. |
Agree. Then this plugin will work as pure |
As far as I can see, at the moment no adaptive cards are used. But for PowerAutomate adaptive cards are mandatory. This is at least my information, maybe I'm wrong. And it's not only the card definition itself. In opposite to “the old method” the card's JSON must be wrapped into "attachments": [] beside the “type”: “message”. If I'm correct, just solving the 202 problem alone won't do the trick. So, may I kindly ask where to edit the card's template? I did not find anything in Jenkins directory. But maybe I've overseen something. |
Unfortunately, you need a premium license to be able to use "When an http request is received", which would allow you to take the current payload Jenkins plugin sends and transform it to an adaptive card to post to a Teams channel. The "When a Teams webhook request is received" trigger does not require a premium license but it expects an adaptive card payload. |
Can you clarify which one is where? This is not clear to me what is the difference or which one will work after office 365 retirement |
Both webhooks will work as they are in the workflow setup (https://make.powerautomate.com/). The "When an http request is received" webhook allows you to supply the payload of the webhook that Microsoft will send. The "When a Teams webhook request is received" webhook expects a payload with a specific structure. |
@jimmygoogle have you tested using the "When a Teams webhook request is received" and received errors when sending a format that doesn't match? I have been able to send whatever payload I want to that trigger and it has been working. Not sure if maybe I just managed to find a loop hole on accident or what. |
Yes I have tried that webhook and I get "Action 'Send_each_adaptive_card' failed: 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." |
I completely agree. That is the trigger which Teams will set up automatically if you click the drop-in replacement link (which, unfortunately, does not create a drop-in replacement) in the warning. Additionally, this is the trigger which you can set up manually without PowerAutomate Premium: This trigger expects:
Otherwise, as you wrote, the error appears: "Action 'Send_each_adaptive_card' failed: 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." |
@PrismaComputer @jimmygoogle sounds to me like you guys just need to iterate over something that exists, not the attachments. Change the "send each adaptive card" to look for just the body. |
“Everyone” using Teams Integration will encounter this problem. It is difficult to imagine that “everyone” will be able to resolve this using Power Automate. Previously, the solution involved simply copying and pasting a generated URL into the plugin. This meant that webhooks were utilized by users and companies without any extensive knowledge of automation. @wjones38 , I understand that it is not your companies fault, but we cannot change the reality. Could you please confirm whether the “old” MessageCard generated by the plugin will continue to work, or if an additional transformation of the card into adaptive-card is necessary, such as in Power Automate? Additionally, do we have a timeline for the 202 fix? |
The 202 fix was merged. According to Microsoft, the notifications as they are right now will stop working in September. The solution is to move to something in workflows. |
You need to do some transformation in power automate and I can't guarantee it will be easy. The web UI is clunky and generally hard to understand but it is possible. If you change the foreach command to look only at the request body, then you can use the same general template that I used:
This should get you most of the way. After that you will just need to look up how to style adaptive cards and plug in the variables from your payload into the adaptive card JSON. |
From what I have observed, it should be possible to export the automation. Would it not be a good idea if someone with a fully functional (not theoretically working) solution shares their anonymised export here? |
@wjones38 got me on the right path and I got this working in Jenkins even with the 202 status returned. I setup a workflow based on the payload that Jenkins sends to the webhook. You can tell the payload after you build the workflow and test and it via Jenkins, Postman, etc. For me, the Jenkins payload looks something like this so this helped me build my adaptive card. I don't see all of the facts that used to be there, I am still looking into that.
Inside the Post card in chat or channel settings, I used this adaptive card JSON. This is what worked for me and my setup. You might be able to copy/paste it or you might need to adapt it to your situation.
The workflow run history will show you successes, failures and it will show you exactly what was sent. Clicking into the run history for a given request is extremely useful. |
Thank you for the information. I am beginning to understand the approach and objective. Although my opinion remains that it is not the administrator's responsibility to fit a square peg into a round hole, the plugin requires fixing. Nevertheless, thank you. I shall wait until all questions (regarding why you do not see all the facts) are answered. Perhaps by then, the plugin will have been improved. If not, we can still resort to more drastic measures. I look forward to your investigation, @jimmygoogle. Thank you very much. |
I am not sure I am going to figure out why the facts are missing or even if they are missing at all. All I know is I dont have the same information in the webhook payload that diplayed previously for us. That might be a configuration thing on our end for all I know. I currently have a working solution so unless the plugin is updated, I am probably going to leave it as is. |
Hello @jimmygoogle, |
And this is, why we need an urgent fix of this plugin. |
Even if/when the plugin is fixed you are still going to need setup a workflow. The readonly option is because you are using one of the precanned flows. You need to build your flow using the 2 steps from above. |
@jimmygoogle : No, I disagree. If the plugin were fixed (or better: given an option to use a different card and expect another return code), there would be no need to set up, tweak, program, modify, or manually handle flows. Within Teams, there's a "fix-it" link embedded in the depreciation warning. If you click this link, a new flow is created automatically—a precanned one, as you call it. This will be done within Teams without requiring any deeper knowledge of Power Automate, and without revealing that this is Power Automate at all. This is how Microsoft anticipates this problem to be resolved. And this is what the typical admin will do and expect to work. Of course, you can ask me, why should the developers of this plugin think this way? |
This is an open source plugin, no one has responsibilities to fix anything. I took a day and learned how Power Automate worked and got a solution working for our situation. We use Team notifications for all sorts of things so it was in our best interest to learn about it and address it. The crux of the problem here is that the notification is expecting an adaptive card but the payload coming from Jenkins is a message card. The easiest thing to do for us was to pass in an adaptive card template with the parts of the payload coming in from Jenkins. |
And to add on that: while nobody is responsible, everyone is invited. If this is a great painpoint for you, the easiest way may be to provide a PR @PrismaComputer. |
Note that a curly bracket |
I've been working this way, if you're interested take a look here: #353 (comment) |
OK, I had a look into Card.java and how it is used. If I got it right, the Card object is build by createCompletedCard and other methods and directly turned into Json just before sending it to the remote. So the object structure defines the json request. Then the The new Workflow does not support ConnectorCards (Card.java) anymore, but AdaptiveCards and "Messages". I personally find AdaptiveCards "nice", but way too bloated. "Messages" on the other hand can contain HTML, but do not get wrapped with an extra border, space and footer message like this "AdaptiveCard": I played around and came up with these basic message jsons. You are able to test the Workflow with via
The 1st and 2nd workflow variants are pretty straight forward in Java code (compared to the current implementation) and on the Workflow side. The possibly supportable elements of an adaptive card can be found here. |
Last week I got this working with Power Automate using its "when a Teams webhook request is received" >>> "Post card in a chat or a channel". I used the adaptive card i think @jimmygoogle posted above here and editted it to suit what I needed. This also involved changing the old teams webhook with Power Automates new webhook for nearly every job I have setup in Jenkins. What I noticed was that I was receiving 3 identical notifications in the Teams channel for every job being completed. I seen this morning that the plugin was updated here so I installed it. That has resolved the 3 notificiations issues and I am only receiving 1 as expected now. |
Yes, I have already noticed that the deprecation warning in Teams has been removed. It appears that the appropriate individuals utilized their support plans and connections with Microsoft to prevent this from happening. Much ado about nothing. …but changes nothing and gives the developers time to implement the user-friendly way. |
Just so nobody else runs into this, I found that viewing Workflows in Teams you do not see the body of the request that was sent, however, the PowerAutomate website, https://make.powerautomate.com, does show the body. After looking at the responses we were receiving for both success and failure, and other examples found here and elsewhere, I was able to build an adaptive card that works well for our needs. |
I wanted to share my 2 cents, since I've been trying to make the switch to a workflow too and eventually got it to work though it took quite a bit of trial and error. Things I've noticed:
The adaptive card:
Here's a clip with the whole workflow, in case someone perhaps finds it useful: I created the image data uri's with the help of this link. |
I also managed to setup a somewhat generic converter Workflow based on @jimmygoogle 's original example:
by adding "Apply to all" loops and Compose data operations: You can also get a colored stripe back by adding a background image that is just a single color and repeating it vertically or horizontally only. Here is the Adaptive Card template json: {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"verticalContentAlignment": "Center",
"msteams": {
"width": "Full"
},
"backgroundImage": {
"url": "data:image/gif;base64,R0lGODlhCAABAIABAAD/AAacDywAAAAACAABAAACA4RvBQA7",
"fillMode": "RepeatVertically"
},
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "Image",
"style": "Person",
"url": "https://www.jenkins.io/images/logos/jenkins/jenkins.png",
"altText": "Jenkins",
"size": "Small"
}
],
"width": "auto"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "@{replace(triggerBody().sections[0].activityTitle, '\', '\\')}",
"color": "@{triggerBody().themeColor}",
"style": "heading",
"wrap": true
}
],
"width": "stretch"
}
]
},
{
"type": "TextBlock",
"text": "@{triggerBody().sections[0].activitySubtitle}",
"wrap": true
},
{
"type": "FactSet",
"facts": @{variables('myfilter')}
}
],
"actions": @{variables('myactions')}
} |
Check out this one . |
We can only support @PrismaComputer, there is a fix necessary in this plugin. We want to send as effortless Teams Notifications as we did so far. That is very possible if the Plugin gets updated. Everything stays simple and lean and the users just need to update their Teams Notification URL to a Teams workflow webhook. |
@manuelwallrapp absolutely correct. |
Thanks for the PR, hopefully it will allow us to proceed with the migration in a smooth and elegant way. |
@claudia-ca Do you know if there is any way to do this hex-color to base64 gif conversion using PowerAutomate? There seem to be string, binary and base64 conversion functions, but no way to get binary string from a hex. |
As I expect that this issue will be resolved by the developers of this plugin and not by each individual user in a slightly different way each time, this message is more for the developers than for the users: Red: I'm interested in whether this can be changed to “Jenkins” instead of “UserXY via Workflows”. However, I fear this can only (and nearly) be solved by creating a user named Jenkins. Magenta: How can we have the task name here instead of “Card”? Orange: How can we remove this completely unnecessary comment? |
Magenta: this is your "Jenkins job display name" afaik
Red/Orange: is IMHO completely up to Microsoft. |
Red: This can be somewhat resolved by the Admin, for example, by using a Workflow owner named “Jenkins”. |
You = the one creating the Jenkins Job. |
Yep, if your company policy allows to have an owner which is not a human. But you're right my answer wasn't correct. |
@markush81, regarding magenta: To prevent further confusion, has your pull request (thanks for that) been merged and released? Is there something to test and see? I apologize for the seemingly obvious question; this information could undoubtedly be found here on GitHub. |
@PrismaComputer no, it is not merged/released. If you're "fearless" you could use my local built version from here https://github.com/markush81/office-365-connector-plugin/releases/tag/alpha and install the |
@PrismaComputer You can remove the Template reference by exporting and important the Workflow. Via Power Automate export to zip and import (only via Website https://make.powerautomate.com/ -> My flows -> select -> Export -> Package (.zip)) works for sure. Maybe copying inside Power Automate also works, but I have not tried it. Of course you can also get this by creating a new Flow from scratch (without starting from a template) |
I have the same issue - notification is sent 3 times. can you please explain what you mean by updated the plugin? we have installed it last week and we have this issue. |
Just update to the latest version of the plugin. That is the one thing they did fix. |
Did you use office-365-connector-plugin to post message from Jenkins using old card format or you have created new payload with adaptive card? |
Just one remark from my side: The new approach with using PowerAutomate has a critical security concern: The new endpoint is "public", which means anyone that knows the endpoint can trigger workflow in user context without user authentication. |
It is the same for Incoming Webhook or Jenkins connectors. Their endpoints are public too, however Power Automate Workflows has an advantage, you can actually set who can trigger the flow through exposed URL. Of course, setting it to anything except |
I'm not sure what is the right way to authenticate with Power Automate and without this knowledge this is hard to implement proper credential support |
Just FYI, if somebody wants to implement authentication with Power Automate it is done via Microsoft Entra ID App using OAuth https://learn.microsoft.com/en-us/power-automate/oauth-authentication?tabs=classic-designer .
Instructions how to configure Entra ID App is here https://forwardforever.com/using-oauth-authentication-for-http-request-triggers-in-power-automate/ . Though I do feel like such kind of authentication is a little bit overkill for such trivial task as webhook trigger. Especially considering that Power Automate workflows for Team webhooks are user based, which means that it requires interactive OAuth authentication every time refresh token expires. |
What feature do you want to see added?
Micorosft has announced that office 365 connector will expire on August 2024. Will this affect the office 365 connector jenkins plugin as well.
https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/
Upstream changes
No response
Are you interested in contributing this feature?
No response
The text was updated successfully, but these errors were encountered: