We are using templates to refine the parameters going to the slack channel from alertmanager, we do have one api to which we are sending alert notifications but while using same templates for api, reloading the alertmanager.yml gives error " field title not found in type config.plain". I have rechecked if there is any indentation error in yaml file. Please suggest whether it is possible for api or not. If yes , please guide me towards it.
{{ define "webhook.default.title" }}{{ template "__subject" . }}{{ end }}
{{ define "webhook.default.username" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "webhook.default.fallback" }}{{ template "webhook.default.title" . }} | {{ template "webhook.default.titlelink" . }}{{ end }}
{{ define "webhook.default.pretext" }}{{ end }}
{{ define "webhook.default.titlelink" }}{{ template "__alertmanagerURL" . }}{{ end }}
{{ define "webhook.default.iconemoji" }}{{ end }}
{{ define "webhook.default.iconurl" }}{{ end }}
{{ define "webhook.default.text" }}{{ end }}
{{ define "webhook.default.footer" }}{{ end }}
- name: "en_api"
webhook_configs:
title: '{{ template "webhook.default.title" . }}'
text: |-
{{ range .Alerts }}
*ALERT:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*DESCRIPTION:* {{ .Annotations.description }}
{{ .Annotations.identifier }}
{{ end }}