Grafana Templates only Showing <no value>

I’ve setup alerts, and they’re working when I’m using no template by leaving the message box empty.

However, after a long search I’ve found that you can pick which template is used, by adding the template to the message panel in a certain contact point.

So, I’ve created a Message Template, that is an exact copy of the default one, which looks like this:

{{ define "test_alert" }}
  [{{.Status}}] {{ .Labels.alertname }}

  Labels:
  {{ range .Labels.SortedPairs }}
    {{ .Name }}: {{ .Value }}
  {{ end }}

  {{ if gt (len .Annotations) 0 }}
  Annotations:
  {{ range .Annotations.SortedPairs }}
    {{ .Name }}: {{ .Value }}
  {{ end }}
  {{ end }}

  {{ if gt (len .SilenceURL ) 0 }}
    Silence alert: {{ .SilenceURL }}
  {{ end }}
  {{ if gt (len .DashboardURL ) 0 }}
    Go to dashboard: {{ .DashboardURL }}
  {{ end }}
{{ end }}

Unfortunately, the messages that arrive in Slack, look like this:

[FIRING:1]  (Test VC test)
[<no value>] <no value>
 Labels:

When using no template, the message looks like this:

**Firing**
Value: [ metric='Name of cronjob 1' labels={job=Name of cronjob} value=77777], [ metric='Name of cronjob 2' labels={job=Name of cronjob} value=77777], [ metric='Name of cronjob 3' labels={job=Name of cronjob} value=77777], [ metric='Name of cronjob 4' labels={job=Name of cronjob} value=77777], 
Labels:
- alertname = Test VC
- test = test
Annotations:

I would like to have the message look like this:

**Firing**
Value: 
[ metric='Name of cronjob 1' value=77777], 
[ metric='Name of cronjob 2' value=77777], 
[ metric='Name of cronjob 3' value=77777], 
[ metric='Name of cronjob 4' value=77777], 
Labels:
- alertname = Test VC
- test = test
Annotations:

My questions are:

  1. How can I see/know what variables I can use between the {{}}?
  2. Why are all these values showing as <no value>
  3. How can I split the Array of Values in the message?
  4. Is there some more documentation besides this, that I’m missing?

Can somebody maybe provide me with a working template, so I can see what I did wrong?

As I believe this is a bug, I’ve created a Github issue here:

The issue was closed, so I’m back here trying to get this working again.

The suggestion by @melori.arellano was:

  1. define the alert template
  2. define the alert message - this one references the alert template created in step 1
  3. reference the alert message template in the message box in the slack contact point
  1. Where should this be created?
  2. I’ve Created a Message template under the Contact Point tab, is this what was meant? The contents of the message are described in the top ticket.
  3. I’ve referenced the alert message in the message box. This works, as I can see the alert (not) working.