Skip to content

Instantly share code, notes, and snippets.

@neolit123
Created July 5, 2018 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neolit123/00835a9eec63de997329f0edf83977f6 to your computer and use it in GitHub Desktop.
Save neolit123/00835a9eec63de997329f0edf83977f6 to your computer and use it in GitHub Desktop.
slack-app-tool
also there could be a specific channel on here with an ongoing feed of recently submitted PRs where the github handle -> slack handle is tracked.
40 replies
bentheelder [1 hour ago]
that would be super noisy! :grimacing: see also https://github.com/integrations/slack/issues/435
neolit123 [1 hour ago]
i see. well in general it feels like pinging someone with the context of immediate action is more reliable over email. the user might not have a slack even, or could be offline. but it is certain that they have an email.
neolit123 [1 hour ago]
if the user is a regular, then pinging on slack is quite viable.
bentheelder [1 hour ago]
we also have this issue with https://github.com/kubernetes/test-infra/tree/master/prow/plugins/slackevents which warns on non-merge-robot merges (IE humans manually messing with git) unless the user is whitelisted (branch managers etc.)... but when it posts a warning it just hopes github username == slack handle which doesn't work for everyone at all...
GitHub
kubernetes/test-infra
test-infra - Test infrastructure for the Kubernetes project.
neolit123 [1 hour ago]
i know that a slack handle isn't a requirement in the membership template, but perhaps it should be considered.
neolit123 [1 hour ago]
i.e. "register in slack and enable notifications"
neolit123 [1 hour ago]
but the different nick names problem persists, unless that's a requirement too. :face_with_rolling_eyes:
bentheelder [1 hour ago]
I think that requiring members to join slack wouldn't go over well, managing notification spam in kubernetes is quite hard and not everyone wants to use hosted / 3rd party tools. asking that the emails match seems reasonable though and if we really start wanting to match up slack handles we can probably work something out around that
neolit123 [1 hour ago]
that's true.
neolit123 [1 hour ago]
what i can do the following days. (maybe next week) is try to match git commit emails to github handles and dump that into a log file, of sorts.
bentheelder [1 hour ago]
one more note on that: there's some concern about hosting a log file like that anywhere, github in particular has restrictions on storing user data
neolit123 [1 hour ago]
yeah, forgot about this concern.
neolit123 [1 hour ago]
so how would the release team access it?
bentheelder [1 hour ago]
I figure if we need this it will probably be low volume and we can just live query git, then query slack
bentheelder [1 hour ago]
i'm not sure how to best restrict access as well, and I think getting a slack app up might be a bit of a hurdle, the prow stuff is via a custom bot user I think.
neolit123 [1 hour ago]
if a slack bot can query the git history it would be great.
neolit123 [1 hour ago]
having said that, i don't have much of an idea on slack bots.
neolit123 [1 hour ago]
`USER: /query-github-user <some-name>`
`BOT: <some-name> has email <some-email> and slack handle <some-handle>`
bentheelder [1 hour ago]
there are a couple of ways to build them, we should be able to run a program ourselves somewhere that clones k/k (part of prow? some parts already do this) and queries it, but not just anyone can set up a bot, the slack admins have to approve it, and a normal slack bot doesn't have access to the email API, only full blow OAuth based apps, i'm not sure how feasible / resaonable it is to build one of those and then restrict it to a single slack
neolit123 [1 hour ago]
so is there an easier location to make the query if not via a slack bot?
neolit123 [1 hour ago]
if the query is over at github then the bots then have to search for an existing user in the slack list of users.
bentheelder [1 hour ago]
slack bots are basically:
- set up one of the options to authenticate against slack as a "bot user" or as a "Slack app"
- get the app enabled for your slack by an admin
- use the slack REST APIs to make actions
- receive events from slack via webhook or by connecting a websocket similar to what the normal client does (at least for bot users)
bentheelder [44 minutes ago]
> so is there an easier location to make the query if not via a slack bot?
er what I mean is slack has two ways of creating integrations with their API
- "slack bots" which have "bot user" accounts, which look kinda like a normal user, but are marked as a bot, and have access to the API.
- "slack apps" which are built entirely differently but can request access to more restricted data when they are enabled
I'm familiar with "slack bots" but not so much "slack apps"
neolit123 [43 minutes ago]
ahh, OK. i not familiar with either.
bentheelder [43 minutes ago]
I think "slack apps" look more like an OAuth integration, while slack bots are more like "create a bot user in your slack chat, then grab the access token and give it to a program that knows how to log in with the token and talk to the slack APIs"
neolit123 [43 minutes ago]
well i don know there is a `slackbot` here and in other workspaces.
bentheelder [42 minutes ago]
that's the third thing, slack itself has a special built-in robot
neolit123 [42 minutes ago]
do you know if anyone has experiece with slack-apps?
neolit123 [38 minutes ago]
given this has to be coordinated with the admins, it might be a bit difficult of someone outside of Google to work on this. (edited)
neolit123 [38 minutes ago]
unless the admins are not from Google. :smile:
bentheelder [32 minutes ago]
i don't think it will have to be someone from google, others have previously worked on the prow integration (in fact I think non-googlers entirely wrote the first version?) and there is a slack-admins channel for talking to them. I'd start a discussion somewhere like a test-infra issue with contribex looped in, and if things look promising discussion wise you could prototype one on your own slack somewhere
bentheelder [32 minutes ago]
that's how i've built slack bots in the past, create your own private foo-testing.slack.com (just using free accounts) and prototype there, then share out once things work
dims [30 minutes ago]
@neolit123 found a (easy looking!) python tutorial for slack app - https://github.com/slackapi/Slack-Python-Onboarding-Tutorial
GitHub
slackapi/Slack-Python-Onboarding-Tutorial
Slack-Python-Onboarding-Tutorial - a simple python onboarding bot and tutorial for Slack
bentheelder [26 minutes ago]
once upon a time I made https://github.com/slack-rs using a test-group to verify functionality, I'd recommend python or go for this though so community members are more likely to contribute :slightly_smiling_face:
GitHub
slack-rs
The slack-rs rust slack (https://slack.com/) api client team.
neolit123 [24 minutes ago]
do we have an issue logged for this?
neolit123 [24 minutes ago]
if not which repo i should do it in?
bentheelder [23 minutes ago]
test-infra makes sense for building the tool I think, another like maybe community might make more sense for discussing if we should have one and how though... (edited)
neolit123 [22 minutes ago]
i can't volunteer for writing the app (too many promises), but i can drop this slack conversation in there + a `help-wanted` label to see if attracts anyone.
neolit123 [22 minutes ago]
maybe it can evolve over time as a collaboration once someone gives the initial push.
bentheelder [21 minutes ago]
:+1:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment