title: Prometheus Alertmanager Slack Configuration: send_resolved as flexible value
body: <p>I want to send a resolve notification to slack based on the alert. Therefore I created an annotation ("resolve") for each alert which is supposed to define if a resolved notification should be send or not.</p>
  
  <p>This is how my alerts look:</p>
  
  <pre><code>        - alert: JobsFailing
            expr: rate(failed_jobs_submitter{job="my_job"}[10m]) &gt; 0
            for: 5m
            labels:
              severity: slack_critical
              service: my_service
            annotations:
              identifier: 'my_service_jobs_failing'
              description: 'Jobs are failing'
              resolve: true
  </code></pre>
  
  <p>This is my alertmanager.yaml:</p>
  
  <pre><code>    global:
        resolve_timeout: 5m
        slack_api_url: 'https://hooks.slack.com/services/...'
        http_config:
          proxy_url: 'some_proxy'
  
      templates:
        - /etc/config/notifications.tpl
  
      route:
        receiver: 'default-receiver'
        group_wait: 5s
        group_interval: 1m
        repeat_interval: 6h
        routes:
        - receiver: slack_critical
          match:
            severity: slack_critical
  
      receivers:
      - name: default-receiver
  
      - name: slack_critical
        slack_configs:
        - channel: '#alert_channel'
          username: "Alert"
          icon_emoji: ":monkey:"
          send_resolved: {{ .Annotations.resolve }}
          title: '{{ template "custom_title" . }}'
          text: '{{ template "custom_slack_message" . }}'
  </code></pre>
  
  <p>I tried using a string instead of a boolean value for .Annotations.resolve</p>
  
  <p>I tried using a template: </p>
  
  <pre><code>{{ define resolve_alert }}{{ if eq .Annotations.resolve "true"}}{{ else }}{{ if eq .Annotations.resolve "false" }}{{ end }}
  </code></pre>
  
  <p>and </p>
  
  <pre><code>send_resolved: {{ template resolve_alert . }}
  </code></pre>
  
  <p>I tried if-clauses:</p>
  
  <pre><code>{{ if eq .Annotations.resolve true }}send_resolved: true{{else}}send_resolved: false{{end}}
  </code></pre>
  
  <pre><code>send_resolved: {{ if or .Annotations.resolve | default false }}
  </code></pre>
  
  <p>I expect the slack configuration to pick up the value .Annotations.resolve and to send a resolved message to slack according to the value defined in the alert. What I get when using .Annotations.resolve:</p>
  
  <pre><code>level=error ts=2019-10-01T09:08:12.284Z caller=coordinator.go:124 component=configuration msg="Loading configuration file failed" file=/etc/config/alertmanager.yml err="yaml: unmarshal errors:\n  line 28: cannot unmarshal !!map into bool"
  </code></pre>
  
  <p>What I get when using a template:</p>
  
  <pre><code>level=error ts=2019-09-30T14:39:29.294Z caller=coordinator.go:124 component=configuration msg="Loading configuration file failed" file=/etc/config/alertmanager.yml err="yaml: line 27: did not find expected key"
  </code></pre>
  
  <p>Any input much appreciated...</p>