# Slack message won't render value

**URL:** <https://community.grafana.com/t/slack-message-wont-render-value/83442>\
**Category:** Alerting\
**Tags:** alerting, templating\
**Created:** [March 8, 2023, 7:51pm UTC](https://community.grafana.com/t/slack-message-wont-render-value/83442 "2023-03-08T19:51:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![horizn](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@horizn](https://community.grafana.com/u/horizn)\
**Post date:** [March 8, 2023, 7:51pm UTC](https://community.grafana.com/t/slack-message-wont-render-value/83442/1 "2023-03-08T19:51:40Z")

</div>

I am trying to get current value from query in Slack message but unfortunately I am getting `{{ humanize $values.A.Value }}` instead.

My Slack message template:

```auto
{{ define "alert_severity_prefix_emoji" -}}
	{{- if ne .Status "firing" -}}
		:white_check_mark:
	{{- else if eq .CommonLabels.severity "critical" -}}
		:red_circle:
	{{- else if eq .CommonLabels.severity "warning" -}}
		:warning:
	{{- end -}}
{{- end -}}

{{ define "slack.title" -}}
  {{ template "alert_severity_prefix_emoji" . }}
	[{{- .Status | toUpper -}}{{- if eq .Status "firing" }} x {{ .Alerts.Firing | len -}}{{- end }}]: {{ .CommonLabels.alertname -}}
{{- end -}}

{{- define "slack.text" -}}
{{- range .Alerts -}}
{{ if gt (len .Annotations ) 0 }}
*Description*: {{ .Annotations.description }}
*Instance*:
{{ range .Labels.SortedPairs }}{{ if or (eq .Name "env") (eq .Name "instance") }}• {{ .Name }}: `{{ .Value }}`
{{ end }}{{ end }}
*Silence alert*: {{ .SilenceURL }}
*Go to dashboard*: {{ .DashboardURL }}
*Go to panel directly*: {{ .PanelURL }}
{{ end }}
{{ end }}
{{ end }}

```

Alert configuration:

 ![grafana_1](https://us1.discourse-cdn.com/grafana/original/3X/a/9/a946d058c70a5ff3c98e1d515a525bdc1ab60100.png)  
 ![grafana_2](https://us1.discourse-cdn.com/grafana/original/3X/4/3/43c3b3d4c0af6382c30bce0caf44ef077bd4e134.png)  
 ![grafana_3](https://us1.discourse-cdn.com/grafana/original/3X/1/3/137a967fc8db8a1bb1b01d210515d7616e5dd1f5.png)  
 ![grafana_4](https://us1.discourse-cdn.com/grafana/original/3X/5/f/5fb2eca872fb991ff91355072cfdffecaf308a31.png)

what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![georgerobinson](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@georgerobinson](https://community.grafana.com/u/georgerobinson)\
**Post date:** [March 9, 2023, 10:29am UTC](https://community.grafana.com/t/slack-message-wont-render-value/83442/2 "2023-03-09T10:29:06Z")

</div>

Hi! 👋

You need to use the value of the Classic Condition `B`. You can’t use the value of `A` as it is a query and queries can return anywhere between 10s and 10,000s of data points, and Grafana doesn’t know which one you want.

We have some documentation explaining this here [Templating labels and annotations | Grafana documentation](https://grafana.com/docs/grafana/latest/alerting/fundamentals/annotation-label/variables-label-annotation/)

---

<div class="post-metadata">

**Author:** ![horizn](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@horizn](https://community.grafana.com/u/horizn)\
**Post date:** [March 9, 2023, 10:47am UTC](https://community.grafana.com/t/slack-message-wont-render-value/83442/3 "2023-03-09T10:47:39Z")

</div>

Hi George,  
No, it won’t work either I’ve tried earlier and it was returning `<no value>` in Slack message. I found the issue. It doesn’t work with classic expressions etc. I managed to make it working by creating two expressions: Reduce and Math:

I wanted to attach a screenshot but unfortunately I am getting: `ExternalUploadHelpers::ExternalUploadValidationError ` error

---

<div class="post-metadata">

**Author:** ![georgerobinson](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@georgerobinson](https://community.grafana.com/u/georgerobinson)\
**Post date:** [March 9, 2023, 11:04am UTC](https://community.grafana.com/t/slack-message-wont-render-value/83442/4 "2023-03-09T11:04:17Z")

</div>

Hi! When using Classic Conditions you need to use the `RefID` and offset of the condition, as explained [here](https://grafana.com/docs/grafana/latest/alerting/fundamentals/annotation-label/variables-label-annotation/#classic-conditions). For example:

```auto
The first condition is {{ $values.B0 }}, and the second condition is {{ $values.B1 }}

```

---

<div class="post-metadata">

**Author:** ![horizn](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@horizn](https://community.grafana.com/u/horizn)\
**Post date:** [March 9, 2023, 11:06am UTC](https://community.grafana.com/t/slack-message-wont-render-value/83442/5 "2023-03-09T11:06:34Z")

</div>

Thats useful information! Thanks, I didn’t find it earlier.
