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

Configuration for Slack channel #73

Closed
romap0 opened this issue Jul 29, 2021 · 10 comments · Fixed by #79
Closed

Configuration for Slack channel #73

romap0 opened this issue Jul 29, 2021 · 10 comments · Fixed by #79
Labels

Comments

@romap0
Copy link

romap0 commented Jul 29, 2021

It would be great to have ability to configure Slack channel via plugin option and environment variable

@juliuscc
Copy link
Owner

juliuscc commented Aug 7, 2021

Slack manages what channel to post messages to. And you configure that when you set up the Slack integration with this tool. So there is no way for this tool to simply control it with an easy to use API. I think the best workaround is to register this app multiple times and give different SLACK_WEBHOOK values as environment variables. But I am not sure if that works. Could you try and report back how it went? If it works we could add it to the documentation.

@SimeonC
Copy link
Contributor

SimeonC commented Dec 15, 2021

@juliuscc are you open to a pull adding an option to provide an alternate config to SLACK_WEBHOOK, namely the combination of SLACK_TOKEN and SLACK_CHANNEL?

In our case, we wanted to not use the webhooks but a shared token secret throughout all our CI project runs as we can define the secret globally and our Infrastructure team can manage the app better.

@juliuscc
Copy link
Owner

I am open to it but I don't fully understand it. Could you explain how the different authentication methods work, and how they differ? I wasn't the one who set up the authentication in the first place 😅

@juliuscc
Copy link
Owner

But yes I think that you have a good point and this feels like a good feature to have. Especially for larger organizations.

@SimeonC
Copy link
Contributor

SimeonC commented Dec 15, 2021

Sure, basically for the slack_webhook way we have to create a new webhook for every channel, and as far as I'm aware if the user who has installed the webhook/app is removed from the slack space then the webhook stops working.

With the token method we can install the app once under a single user (in my case our Infrastructure team is handling this) and generate a single OAuth token, this single OAuth token can be used to send messages to any channel in the workspace (with the chat.public permissions, with the basic chat permissions the app needs to be added to the channel before it can post)

@juliuscc
Copy link
Owner

Would it still be an app that's registered or would it be something else? I think in the case of a webhook it's our app that you run, but with this approach, would you create your own app?

@juliuscc
Copy link
Owner

Sorry if I am asking stupid questions! 😅

I just want to fully understand the user experience implications 😁

@SimeonC
Copy link
Contributor

SimeonC commented Dec 15, 2021

No worries. Im from the "there are no stupid questions" school of thought.

Yea, with the token approach it's an app that you have to register manually so I guess this would classify as a more advanced or technically involved usage rather over the app for this repo. Admittedly I use a custom app instead of the official one due to security concerns.

I think technically you can do it with a user token as well but I've not tried that approach as I don't like the automations posting as me from the CI. According to the slack docs both app bot and user tokens only differ with their permissions around who they can post as.

@juliuscc
Copy link
Owner

This makes sense to me! And now we have saved this conversation for anyone else with the same questions.

juliuscc pushed a commit that referenced this issue Dec 16, 2021
Supporting alternative to the webhook url that makes use of a channel name and oauth token

fix #73
@juliuscc
Copy link
Owner

🎉 This issue has been resolved in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants