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

Simple "plugin" framework using templates *feature* #3

Open
furyfire opened this issue Mar 12, 2019 · 5 comments
Open

Simple "plugin" framework using templates *feature* #3

furyfire opened this issue Mar 12, 2019 · 5 comments

Comments

@furyfire
Copy link

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=&template=github-webhook

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 # #

@eternal-flame-AD
Copy link
Member

eternal-flame-AD commented Mar 12, 2019

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:)

@furyfire
Copy link
Author

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

@eternal-flame-AD
Copy link
Member

eternal-flame-AD commented Mar 12, 2019

@jmattheis Do you think we should have a built-in template engine, or it should exist as a plugin is?

@eternal-flame-AD
Copy link
Member

@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.

@jmattheis
Copy link
Member

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.

@jmattheis jmattheis transferred this issue from gotify/server Mar 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants