Custom templated Alert Message for MSTeams contains default templating?

Hi there.

I’ve been on a templating adventure with Grafana for the last couple of days (Grafana v9.4) and MSTeams.

This is the message for a single alert:

The result is pretty readable now but there is an additional title (“Alert:”) in each Teams post that I can’t for the life of me figure out where is coming from. My guess is that this is a part of the default template that is seeping through from somewhere, somehow, since the line “alert:” does not appear twice or additionally in any of the templates that I’ve made (I have templates for the message, the alerts and the title of the message)

Can I override this? It’s a minor annoyance compared to what the messages used to look like so if it can’t be done, I’m still pretty happy.

Since I’m posting anyway, I’ve tried to get headers (markdown ##Header) to work in the MSTeams template. It isn’t parsing (shows up as escaped instead of being formatted as a header. I have tried ##Header, ##Header##, ## Header and ## Header ## to no avail. Conversely I’ve got bold text, bulletpoints and Italics to work fine. Is this supported at all for MSTeams as a contact point?

Hi! I think it would be easiest if you could share your templates in a reply and then we can take a look at what the issue might be?

Hello, thank you for responding!
I should have included those, sorry about that.

These are my templates:

And this is the contact point configuration for MSTeams:

Here are the custom annotations:

Hi! I think there is an error in the alert_test template on Line 3. You have {{.Labels. }} which is invalid. I think you want {{ .Labels }} without the second dot?

I blurred out a label that goes there. Think of it as being .Labels.node-name

Oh! OK. To answer the question of where the “Alert:” comes from, I can see it here in this screenshot :slight_smile:


Oh my,
I can’t believe I missed that.

Thank you so much! It’s always great to get a second pair of eyes on things. I almost didn’t see it even though you pointed it out.

Do you have any idea about the markdown headers?

Grafana uses Microsoft Teams Adaptive Cards. It uses text blocks for both the header and the message (alerting/teams.go at main · grafana/alerting · GitHub). I’m afraid looking at their docs it seems headers are not supported Text Features - Adaptive Cards | Microsoft Learn.

I see!
I’m new to MSTeams and I was not aware of Adaptive Cards.
I’ve been looking at the wrong markdown settings, it turns out.

Thank you so much for the quick responses and explanations!