frigate-notify
frigate-notify copied to clipboard
Feature: Use a template to generate the message
To give users more flexibility, frigate-notify could allow them to specify the format of message using templating engines like Jinja2 or Go Templates.
There is an assumption, the user would like to define the individual template for each notifier type. Since the frigate-notify uses YAML based single configuration file, the template could be built-in as a dedicated top-level configuration section. For example:
frigate:
...
alerts:
...
monitor:
...
template: # or message_template
telegram: |
{{ if .event }}
Detection at {{ .event.StartTime }}
Camera: {{ .event.Camera }}
Label: {{ .event.Label }} {{ event.TopScore }}
{{ if ge (len .event.Zones) 1 }}
Zone(s): {{ .event.Zones }}
{{ end }}
Links: [Camera]({{ .config.ServerUri }}/cameras/{{ .event.Camera }})
{{- if .event.HasClip }}
| [Event Clip]({{ .config.ServerUri }}/api/events/{{ .event.ID }}/clip.mp4)
{{ end }}
{{ end }}
...
As usual, if no template is specified, a default template will take effect for a particular notifier.
Thank you.