Skip to content

SG: Add the teammate time|handbook commands

Administrator requested to merge jh/sg-slack into main

Created by: jhchabran

This PR adds the people time and people handbook commands to sg.

TODO:

  • Display errors instead of silently failing when a user is not found
  • Try to guess usernames, for example I should be able to type sg people time thorsten instead of sg people time "thorsten ball"

While the code querying the Slack API is pretty straightforward, obtaining the token isn't. For the RFCs, this content is already public so we don't care (I think?) if we publish the appID and appSecret to query our google docs.

When it comes to Slack, that resource is technically internal to SG, so that would be an issue to publish those AFAIU (1). So I took the route of assuming that we have the token stored in our 1Password vault (search for SG Slack Integration, I was able to create one already).

Unless I am mistaken regarding how to handle access, I think that's a fair trade-off for now. If you have a better idea, please tell me!


$ sg people time "Thorsten Ball"
Thorsten Ball's current time is 19 Sep 21 15:42 CEST
$ sg people time "Thorsten Ball"
# open a browser on handbook profile

(1) Also, Slack's OAuth does not support urn:ietf:wg:oauth:2.0:oob as a redirect URI to display the code, we could use https://postmane-echo.com/get for example but that's a bit meh as well. All of that to say, that yeah the 1Password token seems to be the shortest route to this up and running.

Merge request reports

Loading