Custom notification template used in MSTeams contact point not working

Grafana v10.4.7 (8d068faebe), managed so we can not update

Under Contact points > Notification Templates I created a custom template based on the default template in main/templates/default_template.go:

{{ define "__subject" }}[{{ .Status | toUpper }}]{{ end }}

{{ define "minimized.title" }}{{ template "__subject" . }}{{ end }}

It works fine in the preview:

============================>[FIRING]<============================

I add the template to the teams contact point like this:

Then when sending a test notification via “Send test notification”, the Teams title is cut off:

I thought it might be that .Status is not set, hence an error occurs, so I added an if, still with the same result:

{{ define "__subject" }}[{{ if gt (len .Status) 0 }}{{ .Status | toUpper }}{{ end }}]{{ end }}

{{ define "minimized.title" }}{{ template "__subject" . }}{{ end }}

Anyone know what the problem is?

Thanks for your help!

@goulash, you need to pass the context to the template, dot (.) in this case.

{{template "minimized.title" . }}

More details and examples in this docs.