Bold text in notification template inside `{{ range }}` in Microsoft teams is not rendering

The Grafana version that I am using is Grafana v10.0.0 (81d85ce802).

The custom notification template that I am currently using is:

{{ define "my_alert" }}
  Alert: **{{ .Labels.alertname }}**
  {{ if gt (len .Annotations) 0 }}
    {{ range .Annotations.SortedPairs }}
      {{ if or (eq .Name "Summary") (eq .Name "summary") }}
        Summary: **{{ .Value }}**
      {{ end }}
    {{ end }}
  {{ end }}

  Customer/Machine: **{{ .Labels.job }}**
  {{ range .Labels.SortedPairs }}
    {{ if and (ne .Name "env") (ne .Name "instance") (ne .Name "alertname") (ne .Name "customer") (ne .Name "grafana_folder") (ne .Name "hostname") (ne .Name "job") (ne .Name "notification_team") (ne .Name "rulename") (ne .Name "ref_id") (ne .Name "datasource_uid")}}
      - {{ .Name }}: **{{ .Value }}**
    {{ end }}
  {{ end }}

  [Silence 🔕]({{ .SilenceURL }})

  ---------------------------------------------------------------------
{{ end }}

The notifications are sent to the Microsoft teams channel through webhook. The teams version I am using is 1.6.00.19562. It was last updated on 8/3/23. The rendered notification in the Microsoft teams channel looks like:

The highlighted parts should have been rendered as bold text, but they appear as literal text. Also, each list item is supposed to render in a new line, but they are just rendered in the same line. The template is rendered correctly for the parts outside of the {{range}}.

The same template was rendering correctly few days ago and it suddenly stopped working, which I suspect is due to the upgrade of Microsoft teams. The template is rendered correctly when viewed from the phone.

Has anybody else faced the same issue? If so, how can it be resolved?

3 Likes

Hi , I am also facing the same issue. Did you come across any solutions for this?

No. The issue is in the Microsoft teams side as it used to work on old Teams and still works on Android devices.

There is already an issue created on teams support, but the issue still has not been worked on:

There is also an issue created on Grafana repo, but it obviously got closed.

1 Like