I am using Unified Alerting. I had created a custom template and a webhook contact point. But I can’t find somewhere to change default message format to use my custom template. Does anyone know that?
Hey there!
Each Contact Point will have fields listed under the “Optional Settings” dropdown that support message templates, as in the example shown here:
In that example, the template named “mymessage” is referenced in the Text Body field:
{{ template "mymessage" . }}
Not all Contact Points will have the same fields available for customization, but all use the Go templating language.
For the settings available for the Webhook Contact Point for example, if you created a message template named “default.username” to customize the username field, you would reference that as:
{{ template "default.username" . }}
Related docs for easy reference:
Note that the Contact Points and the optional settings for the Contact Points will also vary depending on the type of Alertmanager. For the differences between the two types of Alertmanagers, see this post.
Hi Melody,
but all use the Go templating language
You mention that all use Go templating. @eb17826800084g raised this in relation to a Webhook contact point - Where do I go to add “{{ template “mymessage” . }}” for this type of contact point as it doesn’t appear to support it.
I’m attempting to customise the title of alerts sent to our webhook as we want to add the Status for an obvious means of identifying what’s been resolved. The default templating for this include all labels which is a bit excessive for our implementation, so we’re using either an annotation or template to achieve this.