louislam/uptime-kuma

Adding templating to more notification providers

Open

#646 opened on Oct 11, 2021

View on GitHub
 (32 comments) (89 reactions) (0 assignees)JavaScript (86,760 stars) (7,844 forks)batch import
A:notificationsfeature-requestgood first issuetype:enhance-existing

Description

Is it a duplicate question?

This is a potential solution to a number of other issues, consolidating them into one, and has been discussed briefly in those other issues.

Requests to have different information in the notification

  • #201
  • #543
  • #456
  • Potentiall work around for #570
  • when writing the new templates #543
  • in part (Some plugins could include custom actions via extending the filters that exist within liquidJS) #117

Potential long term bonuses/considerations

Having templates built up would allow for custom reports to be written like requested in #366 (requires a reports task system to be built up) Would allow for inserting custom data into notifications like requested in #202 (would require saving of custom information for monitors/tags/groups/global etc.)

Is your feature request related to a problem? Please describe.

The messages sent in notifications have several different components which many have requested the ability to modify parts of or all of, and each of which requires translation.

Describe the solution you'd like

The implementation of a template engine such as liquidjs to allow users to customize the message sent as they see fit if they wish to do so. This would also condense the messages into as few formats as possible for translation.

Some implementations such as Discord require an object to use the API. In this case, the template would be used to generate a JSON object that would then be parsed and used as the required object.

Describe alternatives you've considered

#627 currently proposes adding regex-bassed key replacement in the email subject. It would also possible to leave the components individual and just customize/translate each one, but that would likely be a messy, hard to update solution.

Additional context

I can see 4 major steps to this.

  1. Create the system to lookup, parse and return the templates
  2. Alter notifications to use common, simple templates in their message
  3. Alter front end & db to allow using custom templates
  4. Implement global template setting

2 and 3 would have to done for the simple notifications, as well as for the JSON object implementations. 1 would basically be re-usable, however a fallback will be required in the case that the data returned from the template is not valid JSON.

I am willing to work on this, however I would like some input & other eyes before I do so. I want to make sure I am not going in the completely wrong direction. This is also a large enough change that, as has been mentioned, I want the sign off of @louislam before I go any further.

Contributor guide