Skip to content

Commit 2d40681

Browse files
committed
update docs with scope options and hook vs. api behavior
1 parent 0896e16 commit 2d40681

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ Run the `_build/default/src/monorobot.exe` binary. The following commands are su
3636
1. [Create a Slack app](https://api.slack.com/apps?new_app=1).
3737
2. Click "Install to Workspace", and when prompted to grant permissions to your workspace, click "Allow".
3838
3. Set up notifications with one of the following methods:
39-
- **Web API (recommended):** To use Slack's [Web API](https://api.slack.com/web), click on "OAuth & Permissions" in your app dashboard's sidebar. Give your bot a *Bot Token Scope* of `chat:write`. Copy the generated OAuth access token (`xoxb-XXXX`) to the `slack_access_token` field of your secrets file. This token is used by the bot to authenticate to the workspace, and remains valid until the token is revoked or the app is uninstalled.
39+
- **Web API (recommended):** To use Slack's [Web API](https://api.slack.com/web), click on "OAuth & Permissions" in your app dashboard's sidebar. Give your bot a *Bot Token Scope* of [`chat:write`](https://api.slack.com/scopes/chat:write) (for per-channel authorization) or [`chat:write.public`](https://api.slack.com/scopes/chat:write.public) (for authorization to all channels). Copy the generated OAuth access token (`xoxb-XXXX`) to the `slack_access_token` field of your secrets file. This token is used by the bot to authenticate to the workspace, and remains valid until the token is revoked or the app is uninstalled. If you use the `chat:write` scope, add the bot to each channel you want to notify.
4040
- **Incoming Webhooks:** To use [incoming webhooks](https://api.slack.com/messaging/webhooks), enable them in your app dashboard and create one for each channel you want to notify. Store them in the `slack_hooks` field of your secrets file. If you decide to notify additional channels later, you will need to update the secrets file with the new webhooks and restart the server.
4141

4242

4343
### Link Unfurling
4444

4545
You can configure Monorobot to [unfurl GitHub links](https://api.slack.com/reference/messaging/link-unfurling) in Slack messages. Currently, commit, pull request, and issue links are supported.
4646

47+
Note: The `slack_access_token` must be configured in your secrets file for link unfurling. See previous section for details.
48+
4749
1. Give your app `links:read` and `links:write` [permissions](https://api.slack.com/apps).
4850
1. Configure your app to [support the Events API](https://api.slack.com/events-api#prepare). During the [url verification handshake](https://api.slack.com/events-api#the-events-api__subscribing-to-event-types__events-api-request-urls__request-url-configuration--verification__url-verification-handshake), you should tell Slack to direct event notifications to `<server_domain>/slack/events`. Ensure the server is running before triggering the handshake.
4951
1. [Register the GitHub domains](https://api.slack.com/reference/messaging/link-unfurling#configuring_domains) you want to support.

documentation/secret_docs.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ A secrets file stores sensitive information. Unlike the repository configuration
2121
| `slack_hooks` | list of channel names and their corresponding webhook endpoint | Yes | try to use token defined in `slack_access_token` instead |
2222
| `slack_signing_secret` | specify to verify incoming slack requests | Yes | - |
2323

24-
Note that either `slack_access_token` or `slack_hooks` must be defined.
24+
Note that either `slack_access_token` or `slack_hooks` must be defined. If both are present, the bot will send notifications using webhooks.
2525

2626
## `gh_token`
2727

@@ -33,11 +33,16 @@ Refer [here](https://docs.github.com/en/free-pro-team@latest/developers/webhooks
3333

3434
## `slack_access_token`
3535

36+
Required for:
37+
- Notification sending via Web API
38+
- Link unfurling
39+
3640
Refer [here](https://api.slack.com/authentication/oauth-v2) for obtaining an access token via OAuth.
3741

3842
## `slack_hooks`
3943

40-
*Note: If `slack_access_token` is also defined, the bot will authenticate over Slack's Web API and this option will not be used.*
44+
Required for:
45+
- Notification sending via webhooks
4146

4247
Expected format:
4348

0 commit comments

Comments
 (0)