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

Slack parser #6

Closed
alexanderadam opened this issue Jul 24, 2019 · 10 comments
Closed

Slack parser #6

alexanderadam opened this issue Jul 24, 2019 · 10 comments

Comments

@alexanderadam
Copy link
Contributor

alexanderadam commented Jul 24, 2019

Initially I was looking for a webhook from gitea to XMPP but now I am thinking that it would probably be much smarter if xmpp-webhook would get a 🎉 Slack parser 🎉 instead.

There are so many services with Slack webhook integrations (even my beloved gitea) and I guess it would help the XMPP ecosystem a lot if it would be as easy to integrate stuff as it is in Slack. IMHO it could be even a game changer for some (i.e. here).

My guess is, that at least the basic API is probably not too bad to implement (the "fancy" example is probably complicated though).

What do you think?

PS: Again, thank you so much for your work! 👍
PPS: the only 'alternative' seems to be an alpha state Prosody module for the that isn't working anymore

@tmsmr
Copy link
Collaborator

tmsmr commented Jul 29, 2019

Hi Alex,

a Gitea parser function shouldn't be a big deal. I wanted to rework this bridge anyway soon...

The biggest change will be that the recipients can be overridden by GET/POST parameters.

Regarding the Slack parser: I'm not sure if i understand you correctly, but this bridge is designed to receive alerts/messages via HTTP and send them to XMPP recipients only. The link you posted points to the Incoming Webhooks documentation of Slack which would be the 'wrong' direction. Outgoing Webhooks seem to be deprecated: https://api.slack.com/custom-integrations/outgoing-webhooks. I don't use Slack (neither private nor with companies i work with/in), so it's hard for me to evaluate this request right now. Are you willing to invest some time and build a prototype with me (After i understood what we are trying to achieve 😄)?

As for your request in the other issue: Sure, a Docker image would be useful (Atleast as dev environment). I'll think about that.

@tmsmr tmsmr mentioned this issue Jul 29, 2019
@alexanderadam
Copy link
Contributor Author

The link you posted points to the Incoming Webhooks documentation of Slack which would be the 'wrong' direction.

Maybe I formulated this in a misleading way:

Gitea (and many other projects) often doesn't have native XMPP webhook support. But they have very often Slack support. So people that favour XMPP over Slack won't be able to use them. Usually those Slack webhooks are for posting a message into a channel when an event occurred.
Furthermore applications usually integrate Slack by using the API for Incoming Webhooks (because it's incoming from the perspective of the Slack interface).

So if xmpp-webhook would be able to parse and interpret the payload that was meant for Slack, it must be able to interpret the JSON hash as described in the incoming API of Slack.
And if xmpp-webook would be able to interpret the payload*, every service with Slack webhook support would automatically have XMPP webhook support (if xmpp-webhook is used).

*I don't think that it would be possible to enable every formatting syntax that Slack supports but I'm sure that 99% of the services have simple output anyway

@tmsmr
Copy link
Collaborator

tmsmr commented Jul 29, 2019

Okay, now i got it 😄. Thanks for the explanation. I thought you want to be able to receive/forward messages from a slack channel.... Now it makes sense.
The only problem i can see atm is how we would be able to override the JID's (The feature that doenst exist yet) with the slack endpoint.

@alexanderadam
Copy link
Contributor Author

What exactly do you mean by override the JID's?

The receiver list is customisable via the environment variable XMPP_RECEIVERS, isn't it?

@tmsmr
Copy link
Collaborator

tmsmr commented Jul 29, 2019

Yes, currently this is the only way the receivers are specified. But one of the changes i want to implement (i wanted to spend some time with it tomorrow actually) is, that the receivers can be set in the webhook request's to override the default config from the environment. Since we can't specify the URL/paramters for the slack integration freely (as far as i understood it correctly, i haven't checked the documentaion yet) this won't be possible in the same way as for Grafana/Prometheus...

@tmsmr
Copy link
Collaborator

tmsmr commented Jul 29, 2019

@alexanderadam Are you available tomorrow for some input regarding Slack? I got some spare time and will try to make a prototpye for the Slack parser...

@alexanderadam
Copy link
Contributor Author

I can respond tomorrow afternoon but I'm not a Slack guy either (that's why I want to have this feature). ;)

@tmsmr
Copy link
Collaborator

tmsmr commented Jan 6, 2020

@svensp has kindly built a parser function for Slack notifications. I just refactored the the feature and would be happy for some feedback!

-> https://github.com/opthomas-prime/xmpp-webhook/tree/slack-handler

@svensp could you verify that the enpoint still works as intended?
@alexanderadam could you have a look at it (test) aswell?

@tmsmr
Copy link
Collaborator

tmsmr commented Jan 26, 2020

I tested the handler using the example request from @svensp (https://github.com/opthomas-prime/xmpp-webhook/blob/master/dev/slack-compatible-notification-example.json) and merged it.

@tmsmr tmsmr closed this as completed Jan 26, 2020
@tmsmr
Copy link
Collaborator

tmsmr commented Jan 26, 2020

(Available in https://github.com/opthomas-prime/xmpp-webhook/releases/tag/0.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants