Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Allow Golang templates for notifier headers #100

Closed
freefd opened this issue Jun 21, 2024 · 4 comments
Closed

Improvement: Allow Golang templates for notifier headers #100

freefd opened this issue Jun 21, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@freefd
Copy link
Contributor

freefd commented Jun 21, 2024

Allow to use Golang template engine for notification headers, as it is already used for the notification body.
Mostly useful for Webhook notifier.

Also, when implemented, the hard-coded X-Actions header for Ntfy can be moved to default Ntfy configuration.

@0x2142 0x2142 self-assigned this Jun 24, 2024
@0x2142 0x2142 added the enhancement New feature or request label Jun 24, 2024
@0x2142 0x2142 added this to the v0.3.3 milestone Jun 24, 2024
@0x2142
Copy link
Owner

0x2142 commented Jun 24, 2024

Sounds good. I'll add it to the backlog 👍

@freefd
Copy link
Contributor Author

freefd commented Aug 12, 2024

Sample usage for Ntfy:

    headers:
      - Authorization: Basic {{ env.Getenv "FN_NTFY_AUTH_BASIC" }}
      - X-Priority: "{{ if ge (len .Zones ) 1 }} 4{{ else }} 3{{ end }}"
      - X-Tags: "{{ if ge (len .Zones ) 1 }} rotating_light, {{ end }}walking"

Produces a message with normal (3) severity when the object is in the camera FOV but out of any zone:
image

And produces a message with high (4) priority when the object crossed the zone:
image

The Ntfy app is configured to only alert on messages of high severity and to keep a silent on messages with normal severity, so as not to bother the user too often.

@0x2142
Copy link
Owner

0x2142 commented Aug 14, 2024

Appreciate you sharing! It's always interesting to see how this is getting used 😊

@0x2142 0x2142 closed this as completed Aug 14, 2024
@freefd
Copy link
Contributor Author

freefd commented Aug 14, 2024

@0x2142, if you'll decide to add this example to the docs, I wouldn't mind :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants