contrib
contrib copied to clipboard
Simple "plugin" framework using templates *feature*
Since the Go language natively support a fairly advanced template engine why not allow for "plugins" to be created using templates alone?
https://push.example.de/message?token=
Gotify would then parse the incomming JSON and apply the "github-webhook" template.
This would allow for an easy way of using webhooks and quickly parsing out one or two fields. Just my two cents # #
I think instead of having built-in support for that, we can actually write a plugin to do that:)
We can accept text/template to parse HTTP header/body and translate it into a formatted message. Golang text/template has a relatively lightweight syntax and is easy to get on:)
Glad you agree It feels like overkill having to write a separate plugin for every webhook there is. And currently there is no way of making gotify accept a randomly formatted json object
@jmattheis Do you think we should have a built-in template engine, or it should exist as a plugin is?
@furyfire Actually we don't need to do so. We can write a single plugin that listens on different URLs for messages, and use different predefined or custom templates to format messages from arbitrary json/plain object.
It feels like overkill having to write a separate plugin for every webhook there is. And currently there is no way of making gotify accept a randomly formatted json object
Yes and no, some webhooks require validation of the message this would add additional calls which cannot easily be generalized.
I agree with @eternal-flame-AD here, lets add a single plugin which supports multiple webhooks / webhook templating.