From 555963281c8d12d9447dd8d12c3edc0b16597bb3 Mon Sep 17 00:00:00 2001 From: BunnyDunker Date: Wed, 15 Nov 2023 13:50:24 -0600 Subject: [PATCH 1/7] Add yml manifest for slack app --- slack-manifest.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 slack-manifest.yml diff --git a/slack-manifest.yml b/slack-manifest.yml new file mode 100644 index 0000000..6b68b90 --- /dev/null +++ b/slack-manifest.yml @@ -0,0 +1,33 @@ +display_information: + name: Slax +features: + bot_user: + display_name: Slax + always_online: false + shortcuts: + - name: Token + type: global + callback_id: access_token + description: Register access token + slash_commands: + - command: /poker + description: poker + should_escape: false +oauth_config: + scopes: + user: + - channels:history + bot: + - channels:history + - chat:write + - chat:write.public + - commands +settings: + event_subscriptions: + user_events: + - message.channels + interactivity: + is_enabled: true + org_deploy_enabled: false + socket_mode_enabled: true + token_rotation_enabled: false From 532cc20830dcf713b846306465088a038c2cf722 Mon Sep 17 00:00:00 2001 From: BunnyDunker Date: Wed, 15 Nov 2023 13:50:54 -0600 Subject: [PATCH 2/7] Update readme with new setup instructions for slack app --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index b58587e..dffbb59 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,31 @@ config :slax, Slax.Github, org_teams: [""] ``` +### Create Slack App +- Go to https://slack.com/get-started#/createnew and create a workspace for testing +- Go to https://api.slack.com/apps +- Click "Create New App" and select "From an app manifest" +- Select your new Slack workspace +- Copy slack-manifest.yml into the field and create the App +- Click "Install to Workspace" and allow it in your workspace +- Generate an app-level token with the "connections:write" scope and copy the generated token into `config/dev.secret.exs` +- Go to the `Install App` menu and copy the Bot User OAuth Token into `config/dev.secret.exs` + ## Usage / Commands All commands provide usage details when executing them without any parameters. +### Issue & PR lookup +With the websocket connection slax parses every message for the specified patterns corresponding to an issue `org/repo#1` `repo#1` or a PR `org/repo$1` `repo$1` + +### /poker +This command is the interaction point for the poker feature and when just typing `/poker` it will respond with a help message on how to use it + +### /token +This is a slack shortcut that is an interactive series of modals to setup project repo connections in the database as well as store fine grained access tokens to enable issue lookup and poker functionality + +### _The following commands have not been tested or used in a while_ + ### /auth This command will authenticate the Slack user with different services so that actions performed will be attributed to that user. This currently supports the following services: From 9ae921477f5e9aae932e902b82dabc9b712ce157 Mon Sep 17 00:00:00 2001 From: BunnyDunker Date: Wed, 15 Nov 2023 14:55:02 -0600 Subject: [PATCH 3/7] Improve configuration section and add config example for Slack configs --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dffbb59..0e55fda 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ A Phoenix app that supports the following slash commands from Slack: ``` git clone https://github.com/revelrylabs/slax ./bin/setup -./bin/server ``` ## Configuration @@ -52,8 +51,17 @@ config :slax, Slax.Github, - Generate an app-level token with the "connections:write" scope and copy the generated token into `config/dev.secret.exs` - Go to the `Install App` menu and copy the Bot User OAuth Token into `config/dev.secret.exs` +```elixir +config :slax, Slax.Slack, + api_url: "https://slack.com/api", + api_token: "", + channel_name: "testing-slax", + app_token: "" +``` + ## Usage / Commands +```./bin/server``` All commands provide usage details when executing them without any parameters. ### Issue & PR lookup From ce5c1d35827af9dd84956c256a926da9115914fd Mon Sep 17 00:00:00 2001 From: BunnyDunker Date: Wed, 15 Nov 2023 14:59:29 -0600 Subject: [PATCH 4/7] Clarification update --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0e55fda..b6b369c 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ git clone https://github.com/revelrylabs/slax ## Configuration The [/bin/setup](https://github.com/revelrylabs/slax/blob/master/bin/setup) script should add a `config/dev.secret.exs` file. Use this to put secrets into. -[/config/runtime.exs](https://github.com/revelrylabs/slax/blob/master/config/runtime.exs) is a good example of what secrets are needed as that file is used to setup secrets in produciton. +[/config/runtime.exs](https://github.com/revelrylabs/slax/blob/master/config/runtime.exs) is a good example of what secrets are needed as that file is used to setup secrets in produciton. (only the configs listed in the following sections are needed for the currently used functionality) -You will need to create a GitHub OAuth app in order to use the GitHub functionality, including authentication. +You will need to create a GitHub OAuth app in order to use the GitHub functionality, including authentication, and a Slack workspace and app. ### Create Github OAuth App @@ -55,7 +55,7 @@ config :slax, Slax.Github, config :slax, Slax.Slack, api_url: "https://slack.com/api", api_token: "", - channel_name: "testing-slax", + channel_name: "", app_token: "" ``` From dca63db7e7f64445a7b1a0c927ac0a9e17cdb1f0 Mon Sep 17 00:00:00 2001 From: BunnyDunker Date: Wed, 15 Nov 2023 15:26:58 -0600 Subject: [PATCH 5/7] Update token shortcut info section --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b6b369c..9793011 100644 --- a/README.md +++ b/README.md @@ -64,14 +64,19 @@ config :slax, Slax.Slack, ```./bin/server``` All commands provide usage details when executing them without any parameters. +### /token +This is a slack shortcut that is an interactive series of modals to setup project repo connections in the database as well as store fine grained access tokens to enable issue lookup and poker functionality. **This is necessary** for proper functionality of Issue/PR lookup and Poker. + +The first modal you see lets you select a Repo and attach an access token and expiration date to it. +The second modal is accessed by clicking Create Repo and lets you either select or create a new Project and attach a Repo to the Project + +To generate a fine grained access token go to https://github.com/settings/tokens?type=beta and fill out the form. Check `Only Select Repositories` and select the desired repo(s). Under Repository Permissions, give at least Read and write to `Issues` and Read only to `Pull Requests` + ### Issue & PR lookup -With the websocket connection slax parses every message for the specified patterns corresponding to an issue `org/repo#1` `repo#1` or a PR `org/repo$1` `repo$1` +With the websocket connection slax parses every message for the specified patterns corresponding to an issue `org/repo#1` `repo#1` or a PR `org/repo$1` `repo$1`. ### /poker -This command is the interaction point for the poker feature and when just typing `/poker` it will respond with a help message on how to use it - -### /token -This is a slack shortcut that is an interactive series of modals to setup project repo connections in the database as well as store fine grained access tokens to enable issue lookup and poker functionality +This command is the interaction point for the poker feature and when just typing `/poker` it will respond with a help message on how to use it. ### _The following commands have not been tested or used in a while_ From 92041861207bb34b535efa8821b849e51eb49e66 Mon Sep 17 00:00:00 2001 From: BunnyDunker Date: Wed, 15 Nov 2023 15:30:08 -0600 Subject: [PATCH 6/7] Add video resource --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9793011..733657e 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ This is a slack shortcut that is an interactive series of modals to setup projec The first modal you see lets you select a Repo and attach an access token and expiration date to it. The second modal is accessed by clicking Create Repo and lets you either select or create a new Project and attach a Repo to the Project -To generate a fine grained access token go to https://github.com/settings/tokens?type=beta and fill out the form. Check `Only Select Repositories` and select the desired repo(s). Under Repository Permissions, give at least Read and write to `Issues` and Read only to `Pull Requests` +To generate a fine grained access token go to https://github.com/settings/tokens?type=beta and fill out the form. Check `Only Select Repositories` and select the desired repo(s). Under Repository Permissions, give at least Read and write to `Issues` and Read only to `Pull Requests`. Extra setup video for Github Access tokens with different permissions: https://www.loom.com/share/43993db839d14fbd86a9ce344e17b7fb ### Issue & PR lookup With the websocket connection slax parses every message for the specified patterns corresponding to an issue `org/repo#1` `repo#1` or a PR `org/repo$1` `repo$1`. From 44d12d24472faa9f092b0a38a5561d87e9838b86 Mon Sep 17 00:00:00 2001 From: BunnyDunker Date: Tue, 28 Nov 2023 12:31:42 -0600 Subject: [PATCH 7/7] Add important notes for use --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 733657e..ac8f704 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ config :slax, Slax.Slack, ```./bin/server``` All commands provide usage details when executing them without any parameters. +> **_NOTE:_** Issue / PR lookup and pokerbot require a fine grained access token be setup for the specified repos with the `/token` command ### /token This is a slack shortcut that is an interactive series of modals to setup project repo connections in the database as well as store fine grained access tokens to enable issue lookup and poker functionality. **This is necessary** for proper functionality of Issue/PR lookup and Poker. @@ -71,6 +72,7 @@ The first modal you see lets you select a Repo and attach an access token and ex The second modal is accessed by clicking Create Repo and lets you either select or create a new Project and attach a Repo to the Project To generate a fine grained access token go to https://github.com/settings/tokens?type=beta and fill out the form. Check `Only Select Repositories` and select the desired repo(s). Under Repository Permissions, give at least Read and write to `Issues` and Read only to `Pull Requests`. Extra setup video for Github Access tokens with different permissions: https://www.loom.com/share/43993db839d14fbd86a9ce344e17b7fb +> **_NOTE:_** For third party organizations, fine grained access tokens must be enabled. ### Issue & PR lookup With the websocket connection slax parses every message for the specified patterns corresponding to an issue `org/repo#1` `repo#1` or a PR `org/repo$1` `repo$1`.