Open The-M1k3y opened 2 months ago
@The-M1k3y
Thanks for reporting this.
I'll look into it.
I have built a crude workaround to make the new Flow system accept the "old" data format.
Start by creating a new "Post to a channel when a webhook request is received" Flow, which can be created by clicking on the "Set up workflow" link in the warning message or in power automate directly., then do the following modifications:
Insert a new Action "Compose" (Data Operation) between "When a Teams webhook request is received" and "Send each adaptive card"
Insert the following code in the new Compose Step under Parameters -> Inputs:
[
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"body": [
{
"type": "TextBlock",
"weight": "Bolder",
"size": "ExtraLarge",
"text": "@{triggerBody()?['title']}"
},
{
"type": "TextBlock",
"text": "@{triggerBody()?['text']}"
}
],
"msteams": {
"width": "Full"
}
}
}
]
Change the Input of the "Send each adaptive card" step (Parameters -> Select An Output From Previous Steps) to the following:
@outputs('Compose')
Configure the "Post your own adaptive card as the Flow bot to a channel" card to send the message to the correct destination.
Be warned: I have no idea how reliable this will work or what content might get lost. This was my first time ever working with power automate and as far as I can tell it is a piece of s*** with the documentation doing an impressive balancing act between not existing and being completely useless and incomplete.
There seems to be some limitations regarding private channels, but I'm way to annoyed by this whole ordeal to figure it out at the moment. It works in private channels when the message gets sent as the User instead of the Flow Bot as long as the User is a member of the channel.
Is there any workaround about this issue? i am using msteams_config in alertmanager. Any ideas how to handle it with Workflows?
Is there any workaround about this issue? i am using msteams_config in alertmanager. Any ideas how to handle it with Workflows?
tl;dr Plop JSON in the text field and parse it from PowerAutomate.
I am working on a hacky solution atm. We can use Power automation functions to parse JSON. We can build our own templates in the "text" field of an alert and do whatever is required to process the message in PowerAutomate🙃 This is how I define my JSON blob as a template: tmp/templates/teams.tmpl
{{ define "teams.txt" }}{'foo':'bar'}{{ end }}
Alert Manager config:
receivers:
- name: "teams"
msteams_configs:
- send_resolved: true
webhook_url: ""
text: '{{ template "teams.txt" . }}'
templates:
- /tmp/templates/*.tmpl
Then use PowerAutomate to parse the text field....
# PowerFX lang? idk man https://learn.microsoft.com/en-us/power-platform/power-fx/overview
json(trigger().outputs['body']['text'])
Because I can do loops and conditionals, I am thinking of doing my complex alert routing via PowerAutomate with a single webhook instead of creating a webhook per channel. I really don't know if I can recommend this approach tho :)
I hate that this works. I feel gross.
I stole a template from this comment: https://github.com/prometheus/alertmanager/issues/3503#issuecomment-2032703905
Defined the template as the text field (see previous comment for how to do that).
Then created the following PowerAutomate workflow
Step 1: Create a "When a Teams webhook request is received" flow or whatever it is.
Step 2: Set a variable by reading the text string field and converting it to an object using the json()
function (shown above)
Step 3: create a "post card in chat or channel" step, and read the "card" data from the variable.
Set the "Adaptive Card" value to the variable you created in step 2.
# Powerfx function
variables("msgs")
Step 4: Profit!
I hate that this works. I feel gross.
I stole a template from this comment: #3503 (comment)
Defined the template as the text field (see previous comment for how to do that). Then created the following PowerAutomate workflow Step 1: Create a "When a Teams webhook request is received" flow or whatever it is. Step 2: Set a variable by reading the text string field and converting it to an object using the
json()
function (shown above) Step 3: create a "post card in chat or channel" step, and read the "card" data from the variable. Set the "Adaptive Card" value to the variable you created in step 2.# Powerfx function variables("msgs")
Step 4: Profit!
thaks for sharing! i tried as u mentioned but failed in 3rd step( ExpressionEvaluationFailed. The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@variables('msgs')' is of type 'Object'. The result must be a valid array. )
I am using alertmanager template in the comment you mentioned, and workflows configuration
I have built a crude workaround to make the new Flow system accept the "old" data format.
Start by creating a new "Post to a channel when a webhook request is received" Flow, which can be created by clicking on the "Set up workflow" link in the warning message or in power automate directly., then do the following modifications:
- Insert a new Action "Compose" (Data Operation) between "When a Teams webhook request is received" and "Send each adaptive card"
- Insert the following code in the new Compose Step under Parameters -> Inputs:
[ { "contentType": "application/vnd.microsoft.card.adaptive", "content": { "body": [ { "type": "TextBlock", "weight": "Bolder", "size": "ExtraLarge", "text": "@{triggerBody()?['title']}" }, { "type": "TextBlock", "text": "@{triggerBody()?['text']}" } ], "msteams": { "width": "Full" } } } ]
- Change the Input of the "Send each adaptive card" step (Parameters -> Select An Output From Previous Steps) to the following:
@outputs('Compose')
- Configure the "Post your own adaptive card as the Flow bot to a channel" card to send the message to the correct destination.
Be warned: I have no idea how reliable this will work or what content might get lost. This was my first time ever working with power automate and as far as I can tell it is a piece of s*** with the documentation doing an impressive balancing act between not existing and being completely useless and incomplete.
There seems to be some limitations regarding private channels, but I'm way to annoyed by this whole ordeal to figure it out at the moment. It works in private channels when the message gets sent as the User instead of the Flow Bot as long as the User is a member of the channel.
In case somebody else encounters the same error. Using this setup, I was confronted with the error AdaptiveCards.AdaptiveSerializationException: Property 'type' must be 'AdaptiveCard'
I adapted the Compose -> Input
to
[
{
"content": {
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"weight": "Bolder",
"size": "ExtraLarge",
"text": "@{triggerBody()?['title']}"
},
{
"type": "TextBlock",
"text": "@{triggerBody()?['text']}"
}
],
"msteams": {
"width": "Full"
}
}
}
]
Works like a charm. Thanks a lot.
I have built a crude workaround to make the new Flow system accept the "old" data format. Start by creating a new "Post to a channel when a webhook request is received" Flow, which can be created by clicking on the "Set up workflow" link in the warning message or in power automate directly., then do the following modifications:
- Insert a new Action "Compose" (Data Operation) between "When a Teams webhook request is received" and "Send each adaptive card"
- Insert the following code in the new Compose Step under Parameters -> Inputs:
[ { "contentType": "application/vnd.microsoft.card.adaptive", "content": { "body": [ { "type": "TextBlock", "weight": "Bolder", "size": "ExtraLarge", "text": "@{triggerBody()?['title']}" }, { "type": "TextBlock", "text": "@{triggerBody()?['text']}" } ], "msteams": { "width": "Full" } } } ]
- Change the Input of the "Send each adaptive card" step (Parameters -> Select An Output From Previous Steps) to the following:
@outputs('Compose')
- Configure the "Post your own adaptive card as the Flow bot to a channel" card to send the message to the correct destination.
Be warned: I have no idea how reliable this will work or what content might get lost. This was my first time ever working with power automate and as far as I can tell it is a piece of s*** with the documentation doing an impressive balancing act between not existing and being completely useless and incomplete. There seems to be some limitations regarding private channels, but I'm way to annoyed by this whole ordeal to figure it out at the moment. It works in private channels when the message gets sent as the User instead of the Flow Bot as long as the User is a member of the channel.
In case somebody else encounters the same error. Using this setup, I was confronted with the error
AdaptiveCards.AdaptiveSerializationException: Property 'type' must be 'AdaptiveCard'
I adapted the
Compose -> Input
to[ { "content": { "type": "AdaptiveCard", "version": "1.2", "body": [ { "type": "TextBlock", "weight": "Bolder", "size": "ExtraLarge", "text": "@{triggerBody()?['title']}" }, { "type": "TextBlock", "text": "@{triggerBody()?['text']}" } ], "msteams": { "width": "Full" } } } ]
Works like a charm. Thanks a lot.
are you using template in alertmanager side? and what integration are u using in alertmanager? is it msteams ?
are you using template in alertmanager side? and what integration are u using in alertmanager? is it msteams ?
I'm using alertmanager v0.27.0 and the relevant "Config" output in the alertmanager status page is
- name: msteams
msteams_configs:
- send_resolved: true
http_config:
follow_redirects: true
enable_http2: true
webhook_url: <secret>
title: '{{ template "msteams.default.title" . }}'
summary: '{{ template "msteams.default.summary" . }}'
text: '{{ template "msteams.default.text" . }}'
are you using template in alertmanager side? and what integration are u using in alertmanager? is it msteams ?
I'm using alertmanager v0.27.0 and the relevant "Config" output in the alertmanager status page is
- name: msteams msteams_configs: - send_resolved: true http_config: follow_redirects: true enable_http2: true webhook_url: <secret> title: '{{ template "msteams.default.title" . }}' summary: '{{ template "msteams.default.summary" . }}' text: '{{ template "msteams.default.text" . }}'
Great! that works for me also. Thank you!
FYI for those of us who were using markdown in the content of the teams notifications, the adaptative cards do not support a lot of things, like tables (https://learn.microsoft.com/en-us/adaptive-cards/authoring-cards/text-features):
Not supported
Headers Tables Images Anything not in the table above
@Mehdizada
re:
ExpressionEvaluationFailed. The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@variables('msgs')' is of type 'Object'. The result must be a valid array.
)
This issue occurred when the final step changed itself to a foreach action instead of a Post to teams:
Below is what you want to confirm:
View https://github.com/prometheus/alertmanager/issues/3920#issuecomment-2220822833 for more details on the var setup
My AM config:
- name: generic-prometheus-alerts
msteams_configs:
- webhook_url: "Workflow_URL"
text: '{{ template "adaptivePain.text" . }}'
Beginning of Go template:
{{ define "adaptivePain.text" }}
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"padding": "None",
"msteams": {
"width": "Full"
},
"body": [
{
"type": "Container",
"id": "alert-msg",
"padding": "Default",
"items": [
{
"type": "TextBlock",
"id": "alert-summary-title",
"text": "[{{- if gt (len .Alerts.Firing) 0 }}FIRING: {{ .Alerts.Firing | len }}] 🔥 {{end}} {{- if gt (len .Alerts.Resolved) 0 }}RESOLVED: {{ .Alerts.Resolved | len }}] ✅ {{end}} {{ with index .Alerts 0 -}}{{ .Labels.alertname }}{{ end }}",
"weight": "Bolder",
"color": "{{- if gt (len .Alerts.Firing) 0 }}Attention{{end}}{{- if gt (len .Alerts.Resolved) 0 }}Good{{end}}",
"size": "ExtraLarge",
"horizontalAlignment": "Left"
},
...
Also note: When I tried updating the variable a few times testing different scenarios, it didn't actually save my changes so I was forced to delete the step and remake it.
My brutal Go template does work in this circumstance as a variable with multiple alerts (below is an example of a grouped alert)
Obviously not amazing to use that wicked template but may be a workaround for alerts with functionality attached until a better solution is found
Also be advised all:
Our team decided to try and go the Microsoft Graph route instead to avoid this madness. We were thinking of using Alertmanager to then ship to an intermediary data transformer to then POST via Graph to the appropriate channels.
The only way for this to work is to have your application registration's permission access in Entrant set as a Delegate, not the application context. You cannot set it to the application context, otherwise when you try to do a POST you'll get an error like:
Unauthorized: Message POST is allowed in application-only context only for import purposes
Why does this matter? It means that the application's permission scope, by acting as a delegate, requires your Microsoft Admin to granularly manage permissions. If you operate a relatively large environment...good luck.
It looks like Teams has some incompatibilities across the product tiers, none of which are documented. I suspect this is something like the enterprise SKUs but did not want to spend time trying to see if they've hidden that information somewhere else on microsoft.com.
The example in https://github.com/prometheus/alertmanager/issues/3920#issuecomment-2219950227 came close to working for me but it turned out there were a couple of key differences:
The Compose input parameter in that comment got a parse error. The version of Teams / Workflows which I have access to expects the input to be a single value, not a list, and also has an undocumented restriction on the Adaptive Card 1.4 schema rather than the latest 1.6 version or the 1.5 version claimed in the Adaptive Card designer, which caused it to unhelpfully say the workflow was successful while the card rendered as “We're sorry, this card couldn't be displayed”. This template works for me:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "@{triggerBody()?['title']}"
},
{
"type": "TextBlock",
"text": "@{triggerBody()?['text']}",
"wrap": true
}
]
}
Does anyone have a solution for sending from Alertmanager without the msteams_configs
and instead the normal webhook webhook_configs
? We are stuck on an old version of Alertmanager.
Does anyone have a solution for sending from Alertmanager without the
msteams_configs
and instead the normal webhookwebhook_configs
? We are stuck on an old version of Alertmanager.
could you maybe use https://github.com/prometheus-msteams/prometheus-msteams ? I dont know if the workarounds here work for that tool
Does anyone have a solution for sending from Alertmanager without the
msteams_configs
and instead the normal webhookwebhook_configs
? We are stuck on an old version of Alertmanager.could you maybe use https://github.com/prometheus-msteams/prometheus-msteams ? I dont know if the workarounds here work for that tool
It did not work with the dynamic URLs as it seems like it's cutting out some parts of the URL. I will give it a full try, though.
The following one works for me. ---set up workflow Adaptive cart template:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "@{triggerBody()?['title']}"
},
{
"type": "TextBlock",
"text": "@{triggerBody()?['text']}",
"wrap": true
}
]
}
outputs('Compose')
alertmanager.yml
- name: 'prometheus-msteams'
msteams_configs:
- send_resolved: true
webhook_url: 'xxxxx'
in alertmanager.yml, don't use templates:
#templates:
# - '/etc/alertmanager/templates/msteam.tmpl'
Thanks @The-M1k3y , @acdha and everyone else who shared their solution with the community in this issue.
I was finally able to get MS Teams alerts to work with the workflows feature :-).
How can I prevent my title from being cut off like this towards the end and make it go to a new line instead? -
@sherwinwater Change msteam.tmpl to the following or do not define msteam.tmpl, you should receive an alert
{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]{{ end }}
{{ define "msteams.default.summary" }}{{ template "__subject" . }}{{ end }}
{{ define "msteams.default.title" }}{{ template "__subject" . }}{{ end }}
{{ define "msteams.default.text" }}
{{ if gt (len .Alerts.Firing) 0 }}
# Alerts Firing:
- Alertname: {{ (index .Alerts.Firing 0).Labels.alertname }}
{{ range .Alerts.Firing }} - {{ .Annotations.description }}
{{ end }}
{{ end }}
{{ if gt (len .Alerts.Resolved) 0 }}
# Alerts Resolved:
- Alertname: {{ (index .Alerts.Resolved 0).Labels.alertname }}
{{ range .Alerts.Resolved }} - {{ .Annotations.description }}
{{ end }}
{{ end }}
{{ end }}
@sherwinwater Change msteam.tmpl to the following or do not define msteam.tmpl, you should receive an alert
{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]{{ end }} {{ define "msteams.default.summary" }}{{ template "__subject" . }}{{ end }} {{ define "msteams.default.title" }}{{ template "__subject" . }}{{ end }} {{ define "msteams.default.text" }} {{ if gt (len .Alerts.Firing) 0 }} # Alerts Firing: - Alertname: {{ (index .Alerts.Firing 0).Labels.alertname }} {{ range .Alerts.Firing }} - {{ .Annotations.description }} {{ end }} {{ end }} {{ if gt (len .Alerts.Resolved) 0 }} # Alerts Resolved: - Alertname: {{ (index .Alerts.Resolved 0).Labels.alertname }} {{ range .Alerts.Resolved }} - {{ .Annotations.description }} {{ end }} {{ end }} {{ end }}
@lzdohh Thank you so much. It works for me after I remove the msteam.tmpl. thanks.
The deadline was actually extended. However, the URL of the webhooks must be updated again by December 31, 2024.
If other system administrators are having difficulties locating the affected teams: I have written a small tool in Golang that uses the Graph API to output the affected teams.
This has helped us enormously, as Microsoft does not offer its own solution for reading the affected channels and teams. We have over 350 teams in our company, which we would otherwise have had to search through manually.
I hope I could help someone here with this.
Independently of my day job, I would like to create an alternative to the native “incoming webhooks”. Maybe someone will benefit from it.
Does anyone have a solution for sending from Alertmanager without the
msteams_configs
and instead the normal webhookwebhook_configs
? We are stuck on an old version of Alertmanager.could you maybe use https://github.com/prometheus-msteams/prometheus-msteams ? I dont know if the workarounds here work for that tool
It did not work with the dynamic URLs as it seems like it's cutting out some parts of the URL. I will give it a full try, though.
You just need to decode the webhook endpoint link, decode the url, you can use this online service https://amp.urldecoder.org/, after that a you need to paste clean url in the config, this helped me bypass the utl problem.
Thank you everyone for sharing your solution, I’m happy because I’m understanding I’m not self with this problem.
I hate that this works. I feel gross.
I stole a template from this comment: #3503 (comment)
Defined the template as the text field (see previous comment for how to do that). Then created the following PowerAutomate workflow Step 1: Create a "When a Teams webhook request is received" flow or whatever it is. Step 2: Set a variable by reading the text string field and converting it to an object using the
json()
function (shown above) Step 3: create a "post card in chat or channel" step, and read the "card" data from the variable. Set the "Adaptive Card" value to the variable you created in step 2.# Powerfx function variables("msgs")
Step 4: Profit!
@6fears7 I tried this method but got below error any idea how to fix it
@maneeshcdls Does it happen for every alert or only for some? I was dealing with the simmilar issue a short while ago. Take a closer look at the output produced by "When a Teams webhook request is received" workflow step - especially the description/summary text being put into the request's body insite the "text:" fields. Some alerts may have bad characters in them, like nested quotes or illegal line breaks. I had this issue with built-in Watchdog and Infoinhibitor alerts. Needed to fix the actual description of the alert in defintions.
I could successfully send OpenShift Alerts to Microsoft Teams channels using the following:
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "@{triggerBody()?['title']}",
"wrap": true
},
{
"type": "TextBlock",
"text": "@{triggerBody()?['text']}",
"wrap": true
}
]
}
- name: MSTeams
msteams_configs:
- webhook_url: <your_url>
send_resolved: true
title: "OKD TST Alarm {{ if eq .Status \"firing\" }}\U0001F6A8 FIRING \U0001F6A8{{- else -}}✅ RESOLVED ✅{{- end -}}"
text: |-
[OKD Alerting]({{ .ExternalURL }})
{{ range .Alerts }}
**Alert**: {{ .Annotations.summary }}
**Severity**: {{ .Labels.severity }}
**Description**: {{ .Annotations.description }}
**Details**:
{{ range .Labels.SortedPairs }} **{{ .Name }}**: {{ .Value }}
{{ end }}
{{ end }}
How can I prevent my title from being cut off like this towards the end and make it go to a new line instead? -
Adding the msteams width:full to Compose step allowed me to have enough space so the title won't cut off:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "@{triggerBody()?['title']}"
},
{
"type": "TextBlock",
"text": "@{triggerBody()?['text']}",
"wrap": true
}
],
"msteams": {
"width": "Full"
}
}
Hi Everyone, Can you please help to suggest how to remove Lables: and Annotations: titles from alerts and also how to add Sources: URL links as button. As I am using below code. { "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.4", "type": "AdaptiveCard", "body": [ { "type": "TextBlock", "size": "Medium", "weight": "Bolder", "text": "@{triggerBody()?['title']}" }, { "type": "TextBlock", "text": "@{triggerBody()?['text']}", "wrap": true } ], "msteams": { "width": "Full" } }
Hi Bhargav,
The text that is being passed on to the adaptive card, @{triggerBody()?['text']}
, needs to be parsed. You can do this by defining custom functions in the Power Automate workflow.
My apologies for the very brief answer, but I will try and update this later today.
Hi Bhargav, The text that is being passed on to the adaptive card,
@{triggerBody()?['text']}
, needs to be parsed. You can do this by defining custom functions in the Power Automate workflow. My apologies for the very brief answer, but I will try and update this later today.
Thanks @SaurabhKoverhoop
my way was like this
Navigate to Teams Workflows
Create New Workflow
Go to Data Collection
Select Post to a channel when a webhook request is received
Fill in the Flow Name
Choose the Team
Choose the Channel
Click Create Flow
Copy the request URL:
https://prod-11.southeastasia.logic.azure.com:443/workflows/7e2c2dc8cc4a4678b1113ede1d55d5a1/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=c-3iiBjByin64STF8bVGeRrjAu6qhGR7QAs_wZ-aF4Q
Edit the Workflow
Go to Workflows
Choose the created workflow
Click Edit
Between When a Teams webhook request is received and Send each adaptive card and one more step, add an action:
In the search field, enter Compose
In the input field, enter the following JSON:
[
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"body": [
{
"type": "TextBlock",
"weight": "Bolder",
"size": "Large",
"text": "@{triggerBody()?['title']}"
},
{
"type": "TextBlock",
"text": "@{triggerBody()?['text']}"
}
],
"msteams": {
"width": "Full"
}
}
}
]
Click on Send each adaptive card
In the field Select an output from previous steps, enter:
outputs('Compose')
Go to Alertmanager Config
Add Receiver
Add the following configuration:
- name: "test-team"
msteams_configs:
- webhook_url: "<webhook from first step>"
send_resolved: true
text: '{{ template "msteams.alert" . }}'
Add Template for Text
Here is a simple template that includes all the needed information:
{{ define "msteams.alert" }}
**Alert**: {{ .CommonLabels.alertname }}
**Severity**: {{ .CommonLabels.severity }}
**Instance**: {{ .CommonLabels.instance }}
{{ range .Alerts }}
**Description**: {{ .Annotations.description }}
**Summary**: {{ .Annotations.summary }}
{{ if .StartsAt }}**Started At**: {{ .StartsAt }}{{ end }}
{{ if .EndsAt }}**Ended At**: {{ .EndsAt }}{{ end }}
{{ end }}
**Alertmanager URL**: {{ .ExternalURL }}
{{- if eq .Status "firing" -}}
[Silence this alert]({{ .ExternalURL }}/#/silences/new?filter=%7B{{- range .CommonLabels.SortedPairs -}}{{- if ne .Name "alertname" -}}{{- .Name }}%3D%22{{- .Value -}}%22%2C%20{{- end -}}{{- end -}}alertname%3D%22{{ .CommonLabels.alertname }}%22%7D)
{{- end }}
{{ end }}
don't forget make domain for webhooks accessible (prod-11.southeastasia.logic.azure.com in this case)
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: teams-webhook
spec:
hosts:
- prod-11.southeastasia.logic.azure.com
ports:
- name: https
number: 443
protocol: HTTPS
location: MESH_EXTERNAL
resolution: DNS
exportTo:
- "."
@yykudrin thanks for your input , do we miss something at step 18 ? it is yellin' this ain't a correct array if we insert "outputs('Compose')"
@odcheck select the Outputs option under compose appearing in Dynamic content.
@odcheck select the Outputs option under compose appearing in Dynamic content.
@yykudrin thanks for your input , do we miss something at step 18 ? it is yellin' this ain't a correct array if we insert "outputs('Compose')"
it is Expression
I have built a crude workaround to make the new Flow system accept the "old" data format.
Start by creating a new "Post to a channel when a webhook request is received" Flow, which can be created by clicking on the "Set up workflow" link in the warning message or in power automate directly., then do the following modifications:
- Insert a new Action "Compose" (Data Operation) between "When a Teams webhook request is received" and "Send each adaptive card"
- Insert the following code in the new Compose Step under Parameters -> Inputs:
[ { "contentType": "application/vnd.microsoft.card.adaptive", "content": { "body": [ { "type": "TextBlock", "weight": "Bolder", "size": "ExtraLarge", "text": "@{triggerBody()?['title']}" }, { "type": "TextBlock", "text": "@{triggerBody()?['text']}" } ], "msteams": { "width": "Full" } } } ]
- Change the Input of the "Send each adaptive card" step (Parameters -> Select An Output From Previous Steps) to the following:
@outputs('Compose')
- Configure the "Post your own adaptive card as the Flow bot to a channel" card to send the message to the correct destination.
Be warned: I have no idea how reliable this will work or what content might get lost. This was my first time ever working with power automate and as far as I can tell it is a piece of s*** with the documentation doing an impressive balancing act between not existing and being completely useless and incomplete.
There seems to be some limitations regarding private channels, but I'm way to annoyed by this whole ordeal to figure it out at the moment. It works in private channels when the message gets sent as the User instead of the Flow Bot as long as the User is a member of the channel.
Thank you for this. I use this config, in PC work fine but the message not appear on my ios msteam app.
Update: For a (seemingly functional) workaround see my comment https://github.com/prometheus/alertmanager/issues/3920#issuecomment-2219950227 below.
Original Issue:
While setting up a new alertmanager - Teams notification via Webhook I noticed a new warning that the current webhook interface will be deprecated.
From August 15th onwards it will not be possible to setup new webhooks. On October 1st all existing webhooks will stop working.
Details here: https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/
A few tests show, that the workflow trigger "Teams webhook" uses a different scheme for its data.
schema of new endpoint according to documentation:
minimal example of a working request body: